Module shards_lib

Common Shards Utilities.

Description

Common Shards Utilities.

Data Types

kv_list()

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

Function Index

get_sup_child/2 Searches the childern of the supervisor SupPid for a child whose Nth element compares equal to Id.
keyfind/2Equivalent to keyfind(Key, KVList, undefined).
keyfind/3 Returns the value to the given Key or Default if it doesn't exist.
keypop/2Equivalent to keypop(Key, KVList1, undefined).
keypop/3 Searches the list of tuples KVList1 for a tuple whose Nth element compares equal to Key.
keyupdate/3Equivalent to keyupdate(Fun, Keys, undefined, TupleList).
keyupdate/4 Updates the given Keys by the result of calling Fun(OldValue).
object_key/2 Returns the key for the given object or list of objects.
read_tabfile/1 Reads the file info related to a tabfile saved previously.
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_sup_child/2

get_sup_child(SupPid, Id) -> Child

Searches the childern of the supervisor SupPid for a child whose Nth element compares equal to Id.

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.

keypop/2

keypop(Key, KVList1) -> any()

Equivalent to keypop(Key, KVList1, undefined).

keypop/3

keypop(Key, KVList1, Default) -> {Value, KVList2}

Searches the list of tuples KVList1 for a tuple whose Nth element compares equal to Key. Returns {Value, KVList2} if such a tuple is found, otherwise {Default, KVList1}. KVList2 is a copy of KVList1 where the first occurrence of Tuple has been removed.

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.

object_key/2

object_key(ObjOrObjs, Meta) -> term()

Returns the key for the given object or list of objects.

read_tabfile/1

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

Reads the file info related to a tabfile saved previously.

to_string/1

to_string(Data::term()) -> string() | no_return()

Converts the input data to a string.

write_tabfile/2

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

Writes to a file a content related to a table.


Generated by EDoc