public class LinearHash
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
io.goshawkdb.client.Connection |
conn
The connection used to create this LinearHash object.
|
io.goshawkdb.client.GoshawkObjRef |
objRef
The underlying Object in GoshawkDB which holds the root data for
the LHash.
|
Constructor and Description |
---|
LinearHash(io.goshawkdb.client.Connection c,
io.goshawkdb.client.GoshawkObjRef ref)
Create a LinearHash object from an existing given GoshawkDB Object.
|
Modifier and Type | Method and Description |
---|---|
static LinearHash |
createEmpty(io.goshawkdb.client.Connection c)
Create a brand new empty LinearHash.
|
io.goshawkdb.client.GoshawkObjRef |
find(byte[] key)
Search the LinearHash for the given key.
|
void |
forEach(java.util.function.BiConsumer<? super byte[],? super io.goshawkdb.client.GoshawkObjRef> action)
Iterate over the entries in the LinearHash.
|
void |
put(byte[] key,
io.goshawkdb.client.GoshawkObjRef value)
Idempotently add the given key and value to the LinearHash.
|
void |
remove(byte[] key)
Idempotently remove any matching entry from the LinearHash.
|
int |
size()
Returns the number of entries in the LinearHash.
|
public final io.goshawkdb.client.Connection conn
public io.goshawkdb.client.GoshawkObjRef objRef
public LinearHash(io.goshawkdb.client.Connection c, io.goshawkdb.client.GoshawkObjRef ref)
GoshawkObjRef
passed is already initialised for LinearHash.c
- The connection this LinearHash
object will be scoped to.ref
- The GoshawkObjRef
which contains the root state of the LinearHash
public static LinearHash createEmpty(io.goshawkdb.client.Connection c) throws java.lang.Exception
c
- The connection this LinearHash
object will be scoped to.LinearHash
java.lang.Exception
- if an unexpected error occurs during the transactions.public io.goshawkdb.client.GoshawkObjRef find(byte[] key) throws java.lang.Exception
Arrays
.equals. If no matching key is found, null is
returned.key
- The key to search forjava.lang.Exception
- if an unexpected error occurs during the transactions.public void put(byte[] key, io.goshawkdb.client.GoshawkObjRef value) throws java.lang.Exception
Arrays
.equals. If a matching key is found, the
corresponding value is updated.key
- The key to search for and add.value
- The value to associate with the key.java.lang.Exception
- if an unexpected error occurs during the transactions.public void remove(byte[] key) throws java.lang.Exception
Arrays
.equals.key
- The to search for and remove.java.lang.Exception
- if an unexpected error occurs during the transactions.public void forEach(java.util.function.BiConsumer<? super byte[],? super io.goshawkdb.client.GoshawkObjRef> action) throws java.lang.Exception
action
- The action to be performed for each entryjava.lang.Exception
- if an unexpected error occurs during the transactions.public int size() throws java.lang.Exception
java.lang.Exception
- if an unexpected error occurs during the transactions.