Module: Prosody::NativeMapOperations

Included in:
NativeJsonMapState, NativeMessageMapState
Defined in:
lib/prosody/native_stubs.rb

Overview

Native String-keyed ordered-map keyed-state handle, vended by the context and wrapped by MapState. 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 entry.

Raises:

  • (NotImplementedError)


659
660
661
# File 'lib/prosody/native_stubs.rb', line 659

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

#commitnil

Durably commits the buffered operations mid-handler.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


686
687
688
# File 'lib/prosody/native_stubs.rb', line 686

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

#contains_key(key) ⇒ Boolean

Answers whether a stored cell exists for a key. No value decode and no resolver run (a message-backed map answers with zero Kafka fetches), but not no-I/O: a cache miss still reads the store.

Parameters:

  • key (String)

    the map key

Returns:

  • (Boolean)

    whether a live cell exists for the key

Raises:

  • (NotImplementedError)


625
626
627
# File 'lib/prosody/native_stubs.rb', line 625

def contains_key(key)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#get(key) ⇒ Object?

Reads the value for a key.

Parameters:

  • key (String)

    the map key

Returns:

  • (Object, nil)

    the value, or nil when the key is absent

Raises:

  • (NotImplementedError)


615
616
617
# File 'lib/prosody/native_stubs.rb', line 615

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

#get_many(keys) ⇒ Array<Object, nil>

Reads several keys in a single isolated batch.

Parameters:

  • keys (Array<String>)

    the keys to read, in order

Returns:

  • (Array<Object, nil>)

    one result per input key

Raises:

  • (NotImplementedError)


633
634
635
# File 'lib/prosody/native_stubs.rb', line 633

def get_many(keys)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#initializeObject

Raises:

  • (NotImplementedError)


607
608
609
# File 'lib/prosody/native_stubs.rb', line 607

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

#keys(direction) ⇒ NativeMapKeyScan

Opens a native ordered scan over the live keys only, yielding bare keys. Skips value decode and the resolver (a message-backed map enumerates keys with zero Kafka fetches), though not no-I/O.

Parameters:

  • direction (Symbol)

    :forward or :backward

Returns:

Raises:



679
680
681
# File 'lib/prosody/native_stubs.rb', line 679

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

#remove(key) ⇒ void

This method returns an undefined value.

Removes a key.

Parameters:

  • key (String)

    the map key

Raises:

  • (NotImplementedError)


652
653
654
# File 'lib/prosody/native_stubs.rb', line 652

def remove(key)
  raise NotImplementedError, "This method is implemented natively in Rust"
end

#rollbacknil

Discards the buffered uncommitted operations.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


693
694
695
# File 'lib/prosody/native_stubs.rb', line 693

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

#scan(direction) ⇒ Object

Opens a native ordered scan over the live entries.

Parameters:

  • direction (Symbol)

    :forward or :backward

Returns:

  • (Object)

    the native cursor

Raises:



668
669
670
# File 'lib/prosody/native_stubs.rb', line 668

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

#set(key, value) ⇒ void

This method returns an undefined value.

Inserts or overwrites a key.

Parameters:

  • key (String)

    the map key

  • value (Object)

    the value to store

Raises:



644
645
646
# File 'lib/prosody/native_stubs.rb', line 644

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