raft_kv v0.2.0 RaftKV.KeyspaceInfo View Source
Link to this section Summary
Functions
Creates a new instance of RaftKV.KeyspaceInfo by using the given dict
A variant of new/1 which returns t or raise if validation fails
Type-aware getter for policy
Type-aware setter for policy
Type-aware getter for shards
Type-aware setter for shards
Updates an existing instance of RaftKV.KeyspaceInfo with the given dict.
The values in the dict are validated by each field’s valid?/1 function.
Returns {:ok, valid_struct} or {:error, reason}
A variant of update/2 which returns t or raise if validation fails.
In other words, update/2 followed by Croma.Result.get!/1
Checks if the given value belongs to t/0 or not
Link to this section Types
t() :: %RaftKV.KeyspaceInfo{
policy: RaftKV.SplitMergePolicy.t(),
shards: Croma.Tuple.t()
}
Link to this section Functions
add_shard(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: t()
check_if_mergeable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t()) :: {:ok, t()} | :error
check_if_splittable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: {:ok, t(), RaftKV.Hash.t()} | :error
Creates a new instance of RaftKV.KeyspaceInfo by using the given dict.
For missing fields, default/0 of each field type will be used.
Returns {:ok, valid_struct} or {:error, reason}.
The values in the dict are validated by each field’s valid?/1 function.
A variant of new/1 which returns t or raise if validation fails.
In other words, new/1 followed by Croma.Result.get!/1.
Type-aware getter for policy.
Type-aware setter for policy.
shard_range_start_positions(RaftKV.KeyspaceInfo.t()) :: [RaftKV.Hash.t()]
Type-aware getter for shards.
Type-aware setter for shards.
store( RaftKV.KeyspaceInfo.t(), %{ optional(RaftKV.Hash.t()) => {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} }, pos_integer() ) :: {t(), [{float(), RaftKV.Hash.t()}], [{float(), RaftKV.Hash.t(), RaftKV.Hash.t()}]}
touch_and_delete( RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t(), pos_integer() ) :: t()
touch_both( RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t(), pos_integer() ) :: t()
Updates an existing instance of RaftKV.KeyspaceInfo with the given dict.
The values in the dict are validated by each field’s valid?/1 function.
Returns {:ok, valid_struct} or {:error, reason}.
A variant of update/2 which returns t or raise if validation fails.
In other words, update/2 followed by Croma.Result.get!/1.
Checks if the given value belongs to t/0 or not.