raft_kv v0.2.2 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

Link to this type t() View Source
t() :: %RaftKV.KeyspaceInfo{
  policy: RaftKV.SplitMergePolicy.t(),
  shards: Croma.Tuple.t()
}

Link to this section Functions

Link to this function add_shard(info, new_range_start) View Source
add_shard(RaftKV.KeyspaceInfo.t(), RaftKV.Hash.t()) :: t()
Link to this function 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
Link to this function check_if_splittable(info, range_start) View Source
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.

Link to this function shard_range_start_positions(a0) View Source
shard_range_start_positions(RaftKV.KeyspaceInfo.t()) :: [RaftKV.Hash.t()]
Link to this function shards(keyspace_info) View Source
shards(t()) :: Croma.Tuple.t()

Type-aware getter for shards.

Link to this function shards(s, field) View Source
shards(t(), Croma.Tuple.t()) :: t()

Type-aware setter for shards.

Link to this function 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()
Link to this function touch_both(info, range_start1, range_start2, time) View Source

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}.

Link to this function update!(s, dict) View Source
update!(t(), Dict.t()) :: t()

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.