Bedrock.DataPlane.Materializer.Basalt.Keyspace (bedrock v0.5.2)
View SourceA keyspace is an ordered set of keys.
Under the hood, an ordered_set ETS table is used to store the keys. It is intended that the keyspace can be read and written concurrently by multiple processes, so we rely on the fact that ETS insert operations are atomic to ensure that the keyspace is always in a consistent state. As such, each key is stored along with a boolean "presence" value. This allows us to determine whether a key has been deleted or not (while still relying on the atomicity of the insert operation).
Summary
Types
Functions
@spec apply_transaction(keyspace :: t(), Bedrock.DataPlane.Transaction.encoded()) :: :ok
@spec close(pkv :: t()) :: :ok
@spec insert_many(keyspace :: t(), keys :: [Bedrock.key()]) :: :ok
@spec key_exists?(keyspace :: t(), Bedrock.key()) :: boolean()
@spec prune(keyspace :: t()) :: {:ok, n_pruned :: non_neg_integer()}