shards
.
This module provides a dynamic supervisor for creating and/or
deleting tables dynamically in runtime and as part of an existing
supervision tree; any application supervision tree using shards
.
To use shards
and make the creates tables part of your
application supervision tree, you have to add to your main
supervisor:
% Supervisor init callback init(GroupName) -> Children = [ shards_group:child_spec(GroupName) ], {ok, {{one_for_one, 10, 10}, Children}}.
After your application starts, you can create and delete tables like so:
> {ok, Pid, Tab} = shards_group:new_table(GroupName, mytab, [named_table]). {ok,<0.194.0>,#Ref<0.3052443831.2753691659.260835>} > shards_group:del_table(GroupName, mytab). ok
child_spec/1 | |
del_table/2 | |
new_table/3 | |
start_link/0 | Equivalent to start_link(shards_group). |
start_link/1 | |
stop/1 | Equivalent to stop(Pid, 5000). |
stop/2 |
del_table(SupRef, Tab) -> ok | {error, Reason}
new_table(SupRef, TabName, Options) -> {ok, TabPid, Tab} | {error, Reason}
start_link() -> any()
Equivalent to start_link(shards_group).
start_link(Name) -> StartRet
stop(Pid) -> any()
Equivalent to stop(Pid, 5000).
stop(SupRef, Timeout) -> ok
Generated by EDoc