mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00

This is based on commit 2731def9159247e6da8a3191783c89683363689c from the zeek-docs repo.
105 lines
3.2 KiB
ReStructuredText
105 lines
3.2 KiB
ReStructuredText
:tocdepth: 3
|
|
|
|
base/utils/hash_hrw.zeek
|
|
========================
|
|
.. zeek:namespace:: 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
|
|
#####
|
|
=================================================== ===================================================================
|
|
:zeek:type:`HashHRW::Pool`: :zeek:type:`record` A collection of sites to distribute keys across.
|
|
:zeek:type:`HashHRW::Site`: :zeek:type:`record` A site/node is a unique location to which you want a subset of keys
|
|
to be distributed.
|
|
:zeek:type:`HashHRW::SiteTable`: :zeek:type:`table` A table of sites, indexed by their id.
|
|
=================================================== ===================================================================
|
|
|
|
Functions
|
|
#########
|
|
=================================================== ========================================
|
|
:zeek:id:`HashHRW::add_site`: :zeek:type:`function` Add a site to a pool.
|
|
:zeek:id:`HashHRW::get_site`: :zeek:type:`function` Returns: the site to which the key maps.
|
|
:zeek:id:`HashHRW::rem_site`: :zeek:type:`function` Remove a site from a pool.
|
|
=================================================== ========================================
|
|
|
|
|
|
Detailed Interface
|
|
~~~~~~~~~~~~~~~~~~
|
|
Types
|
|
#####
|
|
.. zeek:type:: HashHRW::Pool
|
|
:source-code: base/utils/hash_hrw.zeek 22 24
|
|
|
|
:Type: :zeek:type:`record`
|
|
|
|
|
|
.. zeek:field:: sites :zeek:type:`HashHRW::SiteTable` :zeek:attr:`&default` = ``{ }`` :zeek:attr:`&optional`
|
|
|
|
|
|
A collection of sites to distribute keys across.
|
|
|
|
.. zeek:type:: HashHRW::Site
|
|
:source-code: base/utils/hash_hrw.zeek 10 16
|
|
|
|
:Type: :zeek:type:`record`
|
|
|
|
|
|
.. zeek:field:: id :zeek:type:`count`
|
|
|
|
A unique identifier for the site, should not exceed what
|
|
can be contained in a 32-bit integer.
|
|
|
|
|
|
.. zeek:field:: user_data :zeek:type:`any` :zeek:attr:`&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.
|
|
|
|
.. zeek:type:: HashHRW::SiteTable
|
|
:source-code: base/utils/hash_hrw.zeek 19 19
|
|
|
|
:Type: :zeek:type:`table` [:zeek:type:`count`] of :zeek:type:`HashHRW::Site`
|
|
|
|
A table of sites, indexed by their id.
|
|
|
|
Functions
|
|
#########
|
|
.. zeek:id:: HashHRW::add_site
|
|
:source-code: base/utils/hash_hrw.zeek 40 47
|
|
|
|
:Type: :zeek:type:`function` (pool: :zeek:type:`HashHRW::Pool`, site: :zeek:type:`HashHRW::Site`) : :zeek:type:`bool`
|
|
|
|
Add a site to a pool.
|
|
|
|
|
|
:returns: F is the site is already in the pool, else T.
|
|
|
|
.. zeek:id:: HashHRW::get_site
|
|
:source-code: base/utils/hash_hrw.zeek 58 76
|
|
|
|
:Type: :zeek:type:`function` (pool: :zeek:type:`HashHRW::Pool`, key: :zeek:type:`any`) : :zeek:type:`HashHRW::Site`
|
|
|
|
|
|
:returns: the site to which the key maps.
|
|
|
|
.. zeek:id:: HashHRW::rem_site
|
|
:source-code: base/utils/hash_hrw.zeek 49 56
|
|
|
|
:Type: :zeek:type:`function` (pool: :zeek:type:`HashHRW::Pool`, site: :zeek:type:`HashHRW::Site`) : :zeek:type:`bool`
|
|
|
|
Remove a site from a pool.
|
|
|
|
|
|
:returns: F if the site is not in the pool, else T.
|
|
|
|
|