shards
state.
key() = term()
Defines key type.
n_shards() = pos_integer()
Defines number of shards.
op() = r | w | d
Defines operation type.
r
: Read operations.w
: Write operation.d
: Delete operations.pick_fun() = 'fun'(fun((key(), range(), op()) -> non_neg_integer()) | any)
Defines spec function to pick or compute the shard/node.
The function returns a value for Key
within the range 0..Range-1.
range() = pos_integer()
Defines the range or set – range > 0
.
state() = #state{}
Defines shards
state.
state_map() = #{module => module(), sup_name => atom(), n_shards => pos_integer(), pick_shard_fun => pick_fun(), pick_node_fun => pick_fun()}
Defines the map representation of the shards
state:
module
: Module to be used depending on the scope
:
shards_local
or shards_dist
.sup_name
: Registered name for shards_sup
.n_shards
: Number of ETS shards/fragments.pick_shard_fun
: Function callback to pick/compute the shard.pick_node_fun
: Function callback to pick/compute the node.from_map/1 |
Builds a new state from the given Map . |
get/1 |
Returns the state for the given table Tab . |
is_state/1 |
Returns true in the given argument is a valid state, otherwise
false is returned. |
module/1 | |
module/2 | |
n_shards/1 | |
n_shards/2 | |
new/0 | |
new/1 | |
new/2 | |
new/3 | |
new/4 | |
new/5 | |
pick_node_fun/1 | |
pick_node_fun/2 | |
pick_shard_fun/1 | |
pick_shard_fun/2 | |
scope/1 | |
sup_name/1 | |
sup_name/2 | |
to_map/1 |
Converts the given state into a map . |
from_map(Map::#{}) -> state()
Builds a new state
from the given Map
.
get(Tab::atom()) -> state()
Returns the state
for the given table Tab
.
is_state(State::any()) -> boolean()
Returns true
in the given argument is a valid state, otherwise
false
is returned.
module(State::state() | atom()) -> module()
n_shards(State::state() | atom()) -> pos_integer()
new() -> state()
new(Shards::pos_integer()) -> state()
new(Shards::pos_integer(), Module::module()) -> state()
new(Shards::pos_integer(), Module::module(), SupName::atom()) -> state()
new(Shards::pos_integer(), Module::module(), SupName::atom(), PickShardFun::pick_fun()) -> state()
new(Shards::pos_integer(), Module::module(), SupName::atom(), PickShardFun::pick_fun(), PickNodeFun::pick_fun()) -> state()
pick_node_fun(State::state() | atom()) -> pick_fun()
pick_node_fun(Fun::pick_fun(), State::state()) -> state()
pick_shard_fun(State::state() | atom()) -> pick_fun()
pick_shard_fun(Fun::pick_fun(), State::state()) -> state()
scope(State::state() | atom()) -> l | g
sup_name(State::state() | atom()) -> atom()
to_map(State::state()) -> state_map()
Converts the given state
into a map
.
Generated by EDoc, Jul 11 2017, 14:57:01.