Module shards_lib

Common Shards Utilities.

Description

Common Shards Utilities.

Data Types

kv_list()

kv_list() = [{any(), any()}]

Function Index

get_pid/1 Returns the PID associated to the Name.
iterator/1 Returns a sequence of integers that starts with 0 and contains the successive results of adding +1 to the previous element, until NumShards is reached or passed (in the latter case, NumShards is not an element of the sequence).
keyfind/2Equivalent to keyfind(Key, KVList, undefined).
keyfind/3 Returns the value to the given Key or Default if it doesn't exist.
keyupdate/3Equivalent to keyupdate(Fun, Keys, undefined, TupleList).
keyupdate/4 Updates the given Keys by the result of calling Fun(OldValue).
list_shards/2 Returns the list of shard names associated to the given TabName.
pick/3 Pick/computes the shard where the Key will be handled.
read_tabfile/1 Reads the file info related to a tabfile saved previously.
reduce_while/3 Reduces the List until fun returns {halt, any()}'.
shard_name/2 Builds a shard name ShardName.
to_string/1 Converts the input data to a string.
write_tabfile/2 Writes to a file a content related to a table.

Function Details

get_pid/1

get_pid(Name::atom()) -> pid() | no_return()

Returns the PID associated to the Name.

iterator/1

iterator(StateOrNumShards) -> Iterator

Returns a sequence of integers that starts with 0 and contains the successive results of adding +1 to the previous element, until NumShards is reached or passed (in the latter case, NumShards is not an element of the sequence).

keyfind/2

keyfind(Key, KVList) -> any()

Equivalent to keyfind(Key, KVList, undefined).

keyfind/3

keyfind(Key::term(), KVList::kv_list(), Default::term()) -> term()

Returns the value to the given Key or Default if it doesn't exist.

keyupdate/3

keyupdate(Fun, Keys, TupleList) -> any()

Equivalent to keyupdate(Fun, Keys, undefined, TupleList).

keyupdate/4

keyupdate(Fun, Keys, Init, KVList1) -> KVList2

Updates the given Keys by the result of calling Fun(OldValue). If Key doesn't exist, then Init is set.

list_shards/2

list_shards(Tab, NumShards) -> ShardNames

Returns the list of shard names associated to the given TabName. The shard names that were created in the shards:new/2,3 fun.

pick/3

pick(Key, Range, Op) -> Result

Pick/computes the shard where the Key will be handled.

read_tabfile/1

read_tabfile(Filename::shards_local:filename()) -> term() | no_return()

Reads the file info related to a tabfile saved previously.

reduce_while/3

reduce_while(Fun, AccIn, List) -> Result

Reduces the List until fun returns {halt, any()}'.

shard_name/2

shard_name(Tab, Shard) -> ShardName

Builds a shard name ShardName.

to_string/1

to_string(Data) -> Result

Converts the input data to a string.

write_tabfile/2

write_tabfile(Filename::shards_local:filename(), Content::term()) -> ok | {error, term()}

Writes to a file a content related to a table.


Generated by EDoc, Jul 11 2017, 14:57:01.