barrel_p2p_shard (barrel_p2p v0.1.0)

View Source

Summary

Functions

Whether this node currently owns Key.

The current live member set (sorted).

The top-N distinct owner nodes for Key (for replicated placement), best owner first.

The ring partition Key falls in. Consumers (e.g. reminders) use this to map keys to partitions without duplicating ring/hash logic.

The node that should own Key cluster-wide.

Functions

apply_full_sync(Snapshot)

-spec apply_full_sync(#{node() => integer()}) -> ok.

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

init(_)

is_owner(Key)

-spec is_owner(term()) -> boolean().

Whether this node currently owns Key.

members()

-spec members() -> [node()].

The current live member set (sorted).

merge_delta(Delta)

-spec merge_delta(barrel_p2p_ormap:ormap()) -> ok.

owner(P, Members)

owners(Key, N)

-spec owners(term(), pos_integer()) -> [node()].

The top-N distinct owner nodes for Key (for replicated placement), best owner first.

partition(Key)

-spec partition(term()) -> non_neg_integer().

The ring partition Key falls in. Consumers (e.g. reminders) use this to map keys to partitions without duplicating ring/hash logic.

place(Key)

-spec place(term()) -> node() | undefined.

The node that should own Key cluster-wide.

replica_apply_full_sync(Name, Snapshot)

replica_full_sync_snapshot(Name)

replica_merge_delta(Name, Delta)

replica_remove_node(Name, Node)

snapshot()

-spec snapshot() -> {sync, #{node() => integer()}} | empty.

start_link()

subscribe(Pid)

-spec subscribe(pid()) -> ok.

terminate(Reason, State)

unsubscribe(Pid)

-spec unsubscribe(pid()) -> ok.