raft_kv v0.2.5 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()
View Source
t() :: %RaftKV.KeyspaceInfo{
policy: RaftKV.SplitMergePolicy.t(),
shards: Croma.Tuple.t()
}
t() :: %RaftKV.KeyspaceInfo{
policy: RaftKV.SplitMergePolicy.t(),
shards: Croma.Tuple.t()
}
Link to this section Functions
add_shard(info, new_range_start)
View Source
add_shard(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: t()
add_shard(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: t()
check_if_mergeable(info, range_start1, range_start2)
View Source
check_if_mergeable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t()) ::
{:ok, t()} | :error
check_if_mergeable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t()) :: {:ok, t()} | :error
check_if_splittable(info, range_start)
View Source
check_if_splittable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) ::
{:ok, t(), RaftKV.Hash.t()} | :error
check_if_splittable(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: {:ok, t(), RaftKV.Hash.t()} | :error
make(policy)
View Source
make(RaftKV.SplitMergePolicy.t()) :: t()
make(RaftKV.SplitMergePolicy.t()) :: t()
new(dict)
View Source
new(term()) :: Croma.Result.t(t())
new(term()) :: Croma.Result.t(t())
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.
new!(dict) View Source
A variant of new/1 which returns t or raise if validation fails.
In other words, new/1 followed by Croma.Result.get!/1.
policy(keyspace_info)
View Source
policy(t()) :: RaftKV.SplitMergePolicy.t()
policy(t()) :: RaftKV.SplitMergePolicy.t()
Type-aware getter for policy.
policy(s, field)
View Source
policy(t(), RaftKV.SplitMergePolicy.t()) :: t()
policy(t(), RaftKV.SplitMergePolicy.t()) :: t()
Type-aware setter for policy.
shard_range_start_positions(arg0)
View Source
shard_range_start_positions(RaftKV.KeyspaceInfo.t()) :: [RaftKV.Hash.t()]
shard_range_start_positions(RaftKV.KeyspaceInfo.t()) :: [RaftKV.Hash.t()]
shards(keyspace_info)
View Source
shards(t()) :: Croma.Tuple.t()
shards(t()) :: Croma.Tuple.t()
Type-aware getter for shards.
shards(s, field)
View Source
shards(t(), Croma.Tuple.t()) :: t()
shards(t(), Croma.Tuple.t()) :: t()
Type-aware setter for shards.
store(info, map, threshold_time)
View Source
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()}]}
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(info, range_start1, range_start2, time)
View Source
touch_and_delete(
RaftKV.KeyspaceInfo.t(),
RaftKV.Hash.t(),
RaftKV.Hash.t(),
pos_integer()
) :: t()
touch_and_delete( RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t(), RaftKV.Hash.t(), pos_integer() ) :: t()
touch_both(info, range_start1, range_start2, time)
View Source
touch_both(
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()
update(s, dict)
View Source
update(t(), Dict.t()) :: Croma.Result.t(t())
update(t(), Dict.t()) :: Croma.Result.t(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}.
update!(s, dict) View Source
A variant of update/2 which returns t or raise if validation fails.
In other words, update/2 followed by Croma.Result.get!/1.
valid?(value) View Source
Checks if the given value belongs to t/0 or not.