base/utils/hash_hrw.zeek

HashHRW

An implementation of highest random weight (HRW) hashing, also called rendezvous hashing. See https://en.wikipedia.org/wiki/Rendezvous_hashing.

Namespace

HashHRW

Summary

Types

HashHRW::Pool: record

A collection of sites to distribute keys across.

HashHRW::Site: record

A site/node is a unique location to which you want a subset of keys to be distributed.

HashHRW::SiteTable: table

A table of sites, indexed by their id.

Functions

HashHRW::add_site: function

Add a site to a pool.

HashHRW::get_site: function

Returns: the site to which the key maps.

HashHRW::rem_site: function

Remove a site from a pool.

Detailed Interface

Types

HashHRW::Pool
Type

record

sites: HashHRW::SiteTable &default = {  } &optional

A collection of sites to distribute keys across.

HashHRW::Site
Type

record

id: count

A unique identifier for the site, should not exceed what can be contained in a 32-bit integer.

user_data: any &optional

Other data to associate with the site.

A site/node is a unique location to which you want a subset of keys to be distributed.

HashHRW::SiteTable
Type

table [count] of HashHRW::Site

A table of sites, indexed by their id.

Functions

HashHRW::add_site
Type

function (pool: HashHRW::Pool, site: HashHRW::Site) : bool

Add a site to a pool.

Returns

F is the site is already in the pool, else T.

HashHRW::get_site
Type

function (pool: HashHRW::Pool, key: any) : HashHRW::Site

Returns

the site to which the key maps.

HashHRW::rem_site
Type

function (pool: HashHRW::Pool, site: HashHRW::Site) : bool

Remove a site from a pool.

Returns

F if the site is not in the pool, else T.