![]() |
kinetic-c
v0.12.0
Seagate Kinetic Protocol Client Library for C
|
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Macros | |
#define | YACHT_NO_KEY ((int)-1) |
Special value for no key in a hash bucket. More... | |
#define | YACHT_DELETED ((int)-2) |
Special placeholder for a deleted key in a hash bucket. More... | |
Typedefs | |
typedef void( | Yacht_Free_cb )(void *value, void *udata) |
Callback to free values associated with keys. More... | |
Functions | |
struct yacht * | Yacht_Init (uint8_t sz2) |
Init a hash table with approx. More... | |
bool | Yacht_Set (struct yacht *y, int key, void *value, void **old_value) |
Set KEY to VALUE in the table. More... | |
bool | Yacht_Get (struct yacht *y, int key, void **value) |
Get KEY from the table, setting *value if found. More... | |
bool | Yacht_Member (struct yacht *y, int key) |
Check if KEY is in the table. More... | |
bool | Yacht_Remove (struct yacht *y, int key, void **old_value) |
Remove KEY from the table. More... | |
void | Yacht_Free (struct yacht *y, Yacht_Free_cb *cb, void *udata) |
Free the table. More... | |
#define YACHT_NO_KEY ((int)-1) |
#define YACHT_DELETED ((int)-2) |
typedef void( Yacht_Free_cb)(void *value, void *udata) |
struct yacht* Yacht_Init | ( | uint8_t | sz2 | ) |
Init a hash table with approx.
2 ** sz2 buckets.
Definition at line 41 of file yacht.c.
References yacht::buckets, DEF_SZ2, LOG, yacht::mask, yacht::size, yacht::values, and YACHT_NO_KEY.
bool Yacht_Set | ( | struct yacht * | y, |
int | key, | ||
void * | value, | ||
void ** | old_value | ||
) |
Set KEY to VALUE in the table.
Definition at line 97 of file yacht.c.
References yacht::buckets, grow(), insert(), LOG, yacht::mask, MAX_PROBES, yacht::size, and yacht::values.
bool Yacht_Get | ( | struct yacht * | y, |
int | key, | ||
void ** | value | ||
) |
Get KEY from the table, setting *value if found.
Definition at line 73 of file yacht.c.
References yacht::buckets, hash(), LOG, yacht::mask, yacht::size, yacht::values, YACHT_DELETED, and YACHT_NO_KEY.
bool Yacht_Member | ( | struct yacht * | y, |
int | key | ||
) |
Check if KEY is in the table.
Definition at line 91 of file yacht.c.
References LOG, and Yacht_Get().
bool Yacht_Remove | ( | struct yacht * | y, |
int | key, | ||
void ** | old_value | ||
) |
Remove KEY from the table.
RetuBus_RegisterSocket the old value in *old_value, if non-NULL.
Definition at line 174 of file yacht.c.
References yacht::buckets, hash(), LOG, yacht::mask, yacht::size, yacht::values, YACHT_DELETED, and YACHT_NO_KEY.
void Yacht_Free | ( | struct yacht * | y, |
Yacht_Free_cb * | cb, | ||
void * | udata | ||
) |
Free the table.
Definition at line 202 of file yacht.c.
References yacht::buckets, yacht::size, yacht::values, YACHT_DELETED, and YACHT_NO_KEY.