Cuckoo.Bucket
This module implements a Bucket.
Summary
contains?(bucket, element) | Returns |
find(bucket, element) | Tries to find the given |
get(bucket, index) | Returns the element at the specified |
has_room?(bucket) | Checks if the |
new(n) | Creates a new bucket with the given size |
reset(bucket, index) | Resets the entry |
set(bucket, index, element) | Sets the entry |
Functions
Specs:
- contains?(t, pos_integer) :: boolean
Returns true
if the bucket contains the element
, otherwise returns false
.
Alternatively you can use element in bucket
instead of calling this function.
Specs:
- find(t, pos_integer) :: {:ok, non_neg_integer} | {:error, :inexistent}
Tries to find the given element
in the bucket
.
Returns {:ok, index}
if it finds it, otherwise returns {:error, :inexistent}
.
Specs:
- has_room?(t) :: {:ok, pos_integer} | {:error, :full}
Checks if the bucket
has any room left.
Returns { :ok, index }
if it finds an empty entry in the bucket,
otherwise returns { :error, :full }
.
Specs:
Resets the entry index
to the default value.
Returns the updated bucket.