Module: Prosody

Defined in:
lib/prosody.rb,
lib/prosody/state.rb,
lib/prosody/sentry.rb,
lib/prosody/handler.rb,
lib/prosody/request.rb,
lib/prosody/version.rb,
lib/prosody/processor.rb,
lib/prosody/native_stubs.rb,
lib/prosody/configuration.rb,
sig/state.rbs,
sig/sentry.rbs,
sig/handler.rbs,
sig/prosody.rbs,
sig/request.rbs,
sig/version.rbs,
sig/processor.rbs,
sig/configuration.rbs

Defined Under Namespace

Modules: Commands, ErrorClassification, NativeDequeOperations, NativeMapOperations, NativeScanOperations, NativeValueOperations, SentryIntegration, State, _DequeDefinition, _MapDefinition, _MessageDequeDefinition, _MessageMapDefinition, _MessageValueDefinition, _NativeDequeHandle, _NativeMapHandle, _NativeScan, _NativeValueHandle, _ToA, _ToInt, _ToS, _ValueDefinition Classes: AdminClient, AsyncTaskProcessor, CancellationToken, Client, Configuration, Context, DequeState, DynamicResult, Error, EventHandler, EventHandlerError, ExciseMessage, Failure, FormatMismatch, HandlerError, MalformedResponse, MapState, Message, NativeJsonDequeScan, NativeJsonDequeState, NativeJsonMapScan, NativeJsonMapState, NativeJsonValueState, NativeMapKeyScan, NativeMessageDequeScan, NativeMessageDequeState, NativeMessageMapScan, NativeMessageMapState, NativeMessageValueState, NativePublishedDeque, NativePublishedMap, NativePublishedValue, NullValueError, PermanentError, PermanentStateError, PublishedDeque, PublishedMap, PublishedValue, StateDefinition, Success, Timeout, Timer, TransientError, TransientStateError, ValueState

Constant Summary collapse

VERSION =

Current version of the Prosody library.

This version number follows semantic versioning and is used by the gem system to identify the library version.

Returns:

  • (String)
"0.5.0"

Class Method Summary collapse

Class Method Details

.deque(name, ttl: nil, capacity: nil, read_uncommitted: nil, published: nil, read_cache: nil) ⇒ StateDefinition

Defines a deque JSON collection.

Parameters:

  • name (#to_s)

    the collection name (unique within the client)

  • ttl (Integer, nil) (defaults to: nil)

    optional per-write TTL in whole seconds

  • capacity (Integer, nil) (defaults to: nil)

    optional window bound (at least 1); the deque keeps at most this many slots, enforced lazily on push. Runtime-only and mutable across deploys, never persisted (see Prosody::DequeState#push).

  • read_uncommitted (Boolean, nil) (defaults to: nil)

    optional opt-out of transactional staging

Returns:



113
114
115
116
117
118
# File 'lib/prosody/state.rb', line 113

def self.deque(name, ttl: nil, capacity: nil, read_uncommitted: nil, published: nil, read_cache: nil)
  StateDefinition.new(name: name.to_s, kind: "deque", payload: "json",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: published,
    read_cache: read_cache, keyset_limit: nil, capacity: capacity,
    access: DEQUE_ACCESS)
end

.flush_telemetryvoid

This method returns an undefined value.

Exports buffered telemetry without shutting down the process-global pipeline.



16
# File 'sig/prosody.rbs', line 16

def self.flush_telemetry: () -> void

.loggerLogger

Returns the module-level logger, creating a default if not yet set. The default writes to $stdout at INFO level.

Returns:

  • (Logger)


10
11
12
# File 'sig/prosody.rbs', line 10

def self.logger
  @logger ||= Logger.new($stdout).tap { |l| l.level = Logger::INFO }
end

.logger=(logger) ⇒ Logger?

Sets the module-level logger. Pass nil to reset to the default.

Parameters:

  • (Logger, nil)

Returns:

  • (Logger, nil)


13
14
15
# File 'sig/prosody.rbs', line 13

def self.logger=(logger)
  @logger = logger
end

.map(name, ttl: nil, keyset_limit: nil, read_uncommitted: nil, published: nil, read_cache: nil) ⇒ StateDefinition

Defines a String-keyed ordered map JSON collection.

Parameters:

  • name (#to_s)

    the collection name (unique within the client)

  • ttl (Integer, nil) (defaults to: nil)

    optional per-write TTL in whole seconds

  • keyset_limit (Integer, nil) (defaults to: nil)

    optional map-only keyset bound (0..=4096)

  • read_uncommitted (Boolean, nil) (defaults to: nil)

    optional opt-out of transactional staging

Returns:



97
98
99
100
101
102
# File 'lib/prosody/state.rb', line 97

def self.map(name, ttl: nil, keyset_limit: nil, read_uncommitted: nil, published: nil, read_cache: nil)
  StateDefinition.new(name: name.to_s, kind: "map", payload: "json",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: published,
    read_cache: read_cache, keyset_limit: keyset_limit, capacity: nil,
    access: MAP_ACCESS)
end

.message_deque(name, ttl: nil, capacity: nil, read_uncommitted: nil) ⇒ StateDefinition

Defines a deque Kafka-message collection.

Parameters:

  • name (#to_s)

    the collection name (unique within the client)

  • ttl (Integer, nil) (defaults to: nil)

    optional per-write TTL in whole seconds

  • capacity (Integer, nil) (defaults to: nil)

    optional window bound (at least 1); the deque keeps at most this many slots, enforced lazily on push. Runtime-only and mutable across deploys, never persisted (see Prosody::DequeState#push).

  • read_uncommitted (Boolean, nil) (defaults to: nil)

    optional opt-out of transactional staging

Returns:



156
157
158
159
160
161
# File 'lib/prosody/state.rb', line 156

def self.message_deque(name, ttl: nil, capacity: nil, read_uncommitted: nil)
  StateDefinition.new(name: name.to_s, kind: "deque", payload: "message",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: nil,
    read_cache: nil, keyset_limit: nil, capacity: capacity,
    access: MESSAGE_DEQUE_ACCESS)
end

.message_map(name, ttl: nil, keyset_limit: nil, read_uncommitted: nil) ⇒ StateDefinition

Defines a String-keyed ordered map Kafka-message collection.

Parameters:

  • name (#to_s)

    the collection name (unique within the client)

  • ttl (Integer, nil) (defaults to: nil)

    optional per-write TTL in whole seconds

  • keyset_limit (Integer, nil) (defaults to: nil)

    optional map-only keyset bound (0..=4096)

  • read_uncommitted (Boolean, nil) (defaults to: nil)

    optional opt-out of transactional staging

Returns:



140
141
142
143
144
145
# File 'lib/prosody/state.rb', line 140

def self.message_map(name, ttl: nil, keyset_limit: nil, read_uncommitted: nil)
  StateDefinition.new(name: name.to_s, kind: "map", payload: "message",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: nil,
    read_cache: nil, keyset_limit: keyset_limit, capacity: nil,
    access: MESSAGE_MAP_ACCESS)
end

.message_value(name, ttl: nil, read_uncommitted: nil) ⇒ StateDefinition

Defines a single-value Kafka-message collection (items are full messages).

Parameters:

  • name (#to_s)

    the collection name (unique within the client)

  • ttl (Integer, nil) (defaults to: nil)

    optional per-write TTL in whole seconds

  • read_uncommitted (Boolean, nil) (defaults to: nil)

    optional opt-out of transactional staging

Returns:



126
127
128
129
130
131
# File 'lib/prosody/state.rb', line 126

def self.message_value(name, ttl: nil, read_uncommitted: nil)
  StateDefinition.new(name: name.to_s, kind: "value", payload: "message",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: nil,
    read_cache: nil, keyset_limit: nil, capacity: nil,
    access: MESSAGE_VALUE_ACCESS)
end

.shutdown_telemetryvoid

This method returns an undefined value.

Exports buffered telemetry and shuts down the process-global pipeline.



19
# File 'sig/prosody.rbs', line 19

def self.shutdown_telemetry: () -> void

.value(name, ttl: nil, read_uncommitted: nil, published: nil, read_cache: nil) ⇒ void

This method returns an undefined value.

--- definition constructors -------------------------------------------- The message_* siblings return the same structural definition interfaces as their JSON counterparts (the runtime object is one StateDefinition); the [P] type parameter is annotation-only, naming the message payload type.



83
84
85
86
87
88
# File 'lib/prosody/state.rb', line 83

def self.value(name, ttl: nil, read_uncommitted: nil, published: nil, read_cache: nil)
  StateDefinition.new(name: name.to_s, kind: "value", payload: "json",
    ttl_seconds: ttl, read_uncommitted: read_uncommitted, published: published,
    read_cache: read_cache, keyset_limit: nil, capacity: nil,
    access: VALUE_ACCESS)
end