Bedrock (bedrock v0.5.3)
View SourceCore types and utilities for Bedrock, a distributed key-value store.
This module defines the fundamental types used throughout the Bedrock system, including keys, values, versions, and time-related constructs for MVCC transaction processing.
Summary
Functions
The end-of-keyspace sentinel value.
Creates a key range from a minimum inclusive key to a maximum exclusive key.
Types
@type epoch() :: non_neg_integer()
@type interval() :: {time_unit(), non_neg_integer()}
@type interval_in_ms() :: :infinity | non_neg_integer()
@type interval_in_us() :: :infinity | non_neg_integer()
@type key() :: binary()
@type lock_token() :: binary()
@type mutation() :: {:set, key(), value()} | {:clear, key()} | {:clear_range, key(), key()} | {:atomic, :add, key(), value()} | {:atomic, :min, key(), value()} | {:atomic, :max, key(), value()} | {:atomic, :bit_and, key(), value()} | {:atomic, :bit_or, key(), value()} | {:atomic, :bit_xor, key(), value()} | {:atomic, :byte_min, key(), value()} | {:atomic, :byte_max, key(), value()} | {:atomic, :append_if_fits, key(), value()} | {:atomic, :compare_and_clear, key(), value()}
@type quorum() :: pos_integer()
@type range_tag() :: non_neg_integer()
@type service() :: :coordination | :log | :materializer
@type service_id() :: String.t()
@type time_unit() :: Bedrock.Internal.Time.Interval.unit()
@type timeout_in_ms() :: :infinity | non_neg_integer()
@type timestamp_in_ms() :: integer()
@type transaction() :: binary()
@type transaction_map() :: %{ optional(:mutations) => [mutation()] | nil, optional(:write_conflicts) => [key_range()] | nil, optional(:read_conflicts) => {version(), [key_range()]} | nil, optional(:commit_version) => version() | nil, optional(:shard_index) => [{non_neg_integer(), non_neg_integer()}] | nil }
@type value() :: binary()
@type version() :: Bedrock.DataPlane.Version.t()
Functions
@spec end_of_keyspace() :: key()
The end-of-keyspace sentinel value.
This binary value is lexicographically greater than any valid key and is used
to represent unbounded key ranges. For ergonomics, the atom :end is also
accepted in the public API and is automatically converted to this sentinel.
Creates a key range from a minimum inclusive key to a maximum exclusive key.
For convenience, the atom :end is accepted as max_key_exclusive to represent
an unbounded range, and is automatically converted to the end-of-keyspace sentinel.
Parameters
min_key: The minimum key value (inclusive).max_key_exclusive: The maximum key value (exclusive), or:endfor unbounded.
Returns
- A tuple representing the key range.
Examples
iex> Bedrock.key_range("a", "z")
{"a", "z"}
iex> Bedrock.key_range("a", :end)
{"a", <<0xFF, 0xFF>>}