Bedrock.Keyspace (bedrock v0.5.2)
View SourceElixir implementation of FoundationDB Subspace functionality.
A Keyspace represents a well-defined region of keyspace in a FoundationDB database. It provides a convenient way to use FoundationDB tuples to define namespaces for different categories of data. The namespace is specified by a prefix tuple which is prepended to all tuples packed by the keyspace. When unpacking a key with the keyspace, the prefix tuple will be removed from the result.
Based on the pattern from other FoundationDB language bindings (Go, Rust, C++).
Summary
Functions
Add an item to the keyspace, creating a new keyspace. The item will be packed as a single-element tuple and appended.
Create a keyspace that contains all keys in the database.
Check if a key belongs to this keyspace (starts with the prefix).
Create a new keyspace from raw bytes prefix.
Create a nested keyspace by extending this keyspace with the given binary, or term if the keyspace supports key encoding.
Convert the keyspace to a string representation for debugging.
Types
Functions
Add an item to the keyspace, creating a new keyspace. The item will be packed as a single-element tuple and appended.
@spec all() :: t()
Create a keyspace that contains all keys in the database.
Check if a key belongs to this keyspace (starts with the prefix).
@spec get_range_from_repo(t(), repo :: module(), opts :: keyword()) :: Enumerable.t()
Create a new keyspace from raw bytes prefix.
@spec partition(t(), binary(), keyspace_opts()) :: t()
@spec partition(t(), term(), keyspace_opts()) :: t()
Create a nested keyspace by extending this keyspace with the given binary, or term if the keyspace supports key encoding.
Convert the keyspace to a string representation for debugging.