View Source shards_lib (shards v1.1.1)
Summary
Functions
Searches the childern of the supervisor
SupPid for a child whose Nth element compares equal to Id.Equivalent to keyfind(Key, KVList, undefined).
Returns the value to the given
Key or Default if it doesn't exist.Equivalent to keypop(Key, KVList1, undefined).
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.Updates the given
Keys by the result of calling Fun(OldValue). If Key doesn't exist, then Init is set.Returns the key for the given object or list of objects.
Reads the file info related to a tabfile saved previously.
Converts the input data to a string.
Writes to a file a content related to a table.
Types
Functions
-spec get_sup_child(SupPid, Id) -> Child when SupPid :: pid(), Id :: term(), Child :: pid() | undefined | restarting.
SupPid for a child whose Nth element compares equal to Id.
Equivalent to keyfind(Key, KVList, undefined).
Key or Default if it doesn't exist.
Equivalent to keypop(Key, KVList1, undefined).
-spec keypop(Key, KVList1, Default) -> {Value, KVList2} when Key :: term(), KVList1 :: kv_list(), Default :: term(), Value :: term(), KVList2 :: kv_list().
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.
Equivalent to keyupdate(Fun, Keys, undefined, TupleList).
-spec keyupdate(Fun, Keys, Init, KVList1) -> KVList2 when Fun :: fun((Key :: term(), Value :: term()) -> term()), Keys :: [term()], Init :: term(), KVList1 :: kv_list(), KVList2 :: kv_list().
Keys by the result of calling Fun(OldValue). If Key doesn't exist, then Init is set.
-spec object_key(ObjOrObjs, Meta) -> term() when ObjOrObjs :: tuple() | [tuple()], Meta :: shards_meta:t().
-spec read_tabfile(shards:filename()) -> term() | no_return().
-spec write_tabfile(shards:filename(), term()) -> ok | {error, term()}.