Module chashbin

Data Types

chash_key()

chash_key() = index() | chash:index()

chashbin()

chashbin() = #chashbin{size = pos_integer(), owners = owners_bin(), nodes = tuple()}

index()

index() = chash:index_as_int()

iterator()

iterator() = #iterator{pos = non_neg_integer(), start = non_neg_integer(), chbin = chashbin()}

owners_bin()

owners_bin() = <<_:_*176>>

pred_fun()

pred_fun() = fun(({index(), node()}) -> boolean())

Function Index

create/1Create a chashbin from the provided chash
exact_iterator/2
index_owner/2Return the node that owns the given index.
iterator/2 Return an iterator pointing to the index responsible for the given chash key.
itr_next/1Advance the iterator by one ring position.
itr_next_while/2Advance the iterator while Pred({Index, Owner}) returns true
itr_pop/2 Advance the iterator N times, returning a list of the traversed {Index, Owner} pairs as well as the new iterator state.
itr_value/1Return the {Index, Owner} pair pointed to by the iterator.
num_partitions/1Return the number of partitions in a given chashbin
responsible_index/2Determine the ring index responsible for a given chash key.
responsible_position/2Determine the ring position responsible for a given chash key.
to_chash/1Convert a chashbin back to a chash
to_list/1Convert a chashbin to a list of {Index, Owner} pairs.
to_list_filter/2 Convert a chashbin to a list of {Index, Owner} pairs for which Pred({Index, Owner}) returns true

Function Details

create/1

create(X1::chash:chash()) -> chashbin()

Create a chashbin from the provided chash

exact_iterator/2

exact_iterator(Idx, CHBin) -> any()

index_owner/2

index_owner(Idx::index(), CHBin::chashbin()) -> node()

Return the node that owns the given index

iterator/2

iterator(HashKey::first | chash_key(), CHBin::chashbin()) -> iterator()

Return an iterator pointing to the index responsible for the given chash key

itr_next/1

itr_next(Itr::iterator()) -> iterator() | done

Advance the iterator by one ring position

itr_next_while/2

itr_next_while(Pred::pred_fun(), Itr::iterator()) -> iterator()

Advance the iterator while Pred({Index, Owner}) returns true

itr_pop/2

itr_pop(N::pos_integer(), Itr::iterator()) -> {[{index(), node()}], iterator()}

Advance the iterator N times, returning a list of the traversed {Index, Owner} pairs as well as the new iterator state

itr_value/1

itr_value(Iterator::iterator()) -> {index(), node()}

Return the {Index, Owner} pair pointed to by the iterator

num_partitions/1

num_partitions(Chashbin::chashbin()) -> pos_integer()

Return the number of partitions in a given chashbin

responsible_index/2

responsible_index(HashKey::chash_key(), CHBin::chashbin()) -> index()

Determine the ring index responsible for a given chash key

responsible_position/2

responsible_position(HashKey::chash_key(), CHBin::chashbin()) -> non_neg_integer()

Determine the ring position responsible for a given chash key

to_chash/1

to_chash(CHBin::chashbin()) -> chash:chash()

Convert a chashbin back to a chash

to_list/1

to_list(Chashbin::chashbin()) -> [{index(), node()}]

Convert a chashbin to a list of {Index, Owner} pairs

to_list_filter/2

to_list_filter(Pred::pred_fun(), Chashbin::chashbin()) -> [{index(), node()}]

Convert a chashbin to a list of {Index, Owner} pairs for which Pred({Index, Owner}) returns true


Generated by EDoc