Class: Prosody::ValueState
- Inherits:
-
Object
- Object
- Prosody::ValueState
- Defined in:
- lib/prosody/state.rb,
sig/state.rbs
Overview
--- handles ------------------------------------------------------------ A single-value keyed-state handle. Reads return the stored value or nil. Every op is fiber-yield async: it looks blocking but never blocks the thread.
Instance Method Summary collapse
-
#clear ⇒ void
Buffers a clear of the value.
-
#commit ⇒ nil
Durably commits the buffered operations mid-handler.
-
#get ⇒ Object?
(also: #value)
Reads the current value.
-
#initialize(native) ⇒ ValueState
constructor
A new instance of ValueState.
-
#rollback ⇒ nil
Discards the buffered uncommitted operations.
-
#set(value) ⇒ void
(also: #value=)
Buffers a write of the value.
Constructor Details
#initialize(native) ⇒ ValueState
Returns a new instance of ValueState.
326 327 328 |
# File 'lib/prosody/state.rb', line 326 def initialize(native) @native = native end |
Instance Method Details
#clear ⇒ void
This method returns an undefined value.
Buffers a clear of the value.
345 |
# File 'lib/prosody/state.rb', line 345 def clear = @native.clear |
#commit ⇒ nil
Durably commits the buffered operations mid-handler.
350 |
# File 'lib/prosody/state.rb', line 350 def commit = @native.commit |
#get ⇒ Object? Also known as: value
Reads the current value.
333 |
# File 'lib/prosody/state.rb', line 333 def get = @native.get |
#rollback ⇒ nil
Discards the buffered uncommitted operations.
355 |
# File 'lib/prosody/state.rb', line 355 def rollback = @native.rollback |
#set(value) ⇒ void Also known as: value=
This method returns an undefined value.
Buffers a write of the value.
340 |
# File 'lib/prosody/state.rb', line 340 def set(value) = @native.set(value) |