Module: Prosody::NativeDequeOperations

Included in:
NativeJsonDequeState, NativeMessageDequeState
Defined in:
lib/prosody/native_stubs.rb

Overview

Native deque keyed-state handle, vended by the context and wrapped by DequeState. Every operation is fiber-yield async, except #scan, which opens the cursor synchronously; each native cursor pull yields the fiber.

See Also:

  • for implementation

Instance Method Summary collapse

Instance Method Details

#clearvoid

This method returns an undefined value.

Removes every element.

Raises:

  • (NotImplementedError)


794
795
796
# File 'lib/prosody/native_stubs.rb', line 794

def clear
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#commitnil

Durably commits the buffered operations mid-handler.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


810
811
812
# File 'lib/prosody/native_stubs.rb', line 810

def commit
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#get(index) ⇒ Object?

Reads the element at front-relative position.

Parameters:

  • index (Integer)

    the zero-based position from the front

Returns:

  • (Object, nil)

    the element, or nil past the end

Raises:

  • (NotImplementedError)


736
737
738
# File 'lib/prosody/native_stubs.rb', line 736

def get(index)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#initializeObject

Raises:

  • (NotImplementedError)


714
715
716
# File 'lib/prosody/native_stubs.rb', line 714

def initialize
  raise NotImplementedError, "This class is implemented natively in Rust"
end

#is_emptyBoolean

Whether the deque holds no live elements.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


728
729
730
# File 'lib/prosody/native_stubs.rb', line 728

def is_empty
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#lenInteger

The number of live elements.

Returns:

  • (Integer)

Raises:

  • (NotImplementedError)


721
722
723
# File 'lib/prosody/native_stubs.rb', line 721

def len
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#peek_backObject?

Reads the back endpoint slot, or nil when empty. Same endpoint-slot semantics as #peek_front.

Returns:

  • (Object, nil)

    the back element, or nil when empty

Raises:

  • (NotImplementedError)


753
754
755
# File 'lib/prosody/native_stubs.rb', line 753

def peek_back
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#peek_frontObject?

Reads the front endpoint slot, or nil when empty. One round trip, no length read; an expired endpoint slot under a TTL yields nil even when live interior elements remain (a peek never searches inward).

Returns:

  • (Object, nil)

    the front element, or nil when empty

Raises:

  • (NotImplementedError)


745
746
747
# File 'lib/prosody/native_stubs.rb', line 745

def peek_front
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#pop_backObject?

Removes and returns the back element.

Returns:

  • (Object, nil)

    the removed element, or nil when empty

Raises:

  • (NotImplementedError)


787
788
789
# File 'lib/prosody/native_stubs.rb', line 787

def pop_back
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#pop_frontObject?

Removes and returns the front element.

Returns:

  • (Object, nil)

    the removed element, or nil when empty

Raises:

  • (NotImplementedError)


780
781
782
# File 'lib/prosody/native_stubs.rb', line 780

def pop_front
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#push_back(value) ⇒ void

This method returns an undefined value.

Appends an element at the back.

Parameters:

  • value (Object)

    the element

Raises:



763
764
765
# File 'lib/prosody/native_stubs.rb', line 763

def push_back(value)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#push_front(value) ⇒ void

This method returns an undefined value.

Prepends an element at the front.

Parameters:

  • value (Object)

    the element

Raises:



773
774
775
# File 'lib/prosody/native_stubs.rb', line 773

def push_front(value)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#rollbacknil

Discards the buffered uncommitted operations.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


817
818
819
# File 'lib/prosody/native_stubs.rb', line 817

def rollback
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#scan(direction) ⇒ Object

Opens a native scan over the live elements.

Parameters:

  • direction (Symbol)

    :forward or :backward

Returns:

  • (Object)

    the native cursor

Raises:



803
804
805
# File 'lib/prosody/native_stubs.rb', line 803

def scan(direction)
  raise NotImplementedError, "This method is implemented natively in Rust"
end