|
JKV * | j_kv_new (gchar const *namespace, gchar const *key) |
|
JKV * | j_kv_new_for_index (guint32 index, gchar const *namespace, gchar const *key) |
|
JKV * | j_kv_ref (JKV *kv) |
|
void | j_kv_unref (JKV *kv) |
|
void | j_kv_put (JKV *kv, gpointer value, guint32 value_len, GDestroyNotify value_destroy, JBatch *batch) |
|
void | j_kv_delete (JKV *kv, JBatch *batch) |
|
void | j_kv_get (JKV *kv, gpointer *value, guint32 *value_len, JBatch *batch) |
|
void | j_kv_get_callback (JKV *kv, JKVGetFunc func, gpointer data, JBatch *batch) |
|
JBackend * | j_kv_get_backend (void) |
|
Data structures and functions for managing key-value pairs.
◆ JKV
◆ JKVGetFunc
typedef void(* JKVGetFunc) (gpointer, guint32, gpointer) |
A callback for j_kv_get_callback.
The callback will receive a pointer to the value (must be freed by the caller), the value's length and a pointer to optional user-provided data.
◆ JKVOperation
◆ j_kv_delete()
void j_kv_delete |
( |
JKV * |
kv, |
|
|
JBatch * |
batch |
|
) |
| |
Deletes a key-value pair.
- Parameters
-
◆ j_kv_get()
void j_kv_get |
( |
JKV * |
kv, |
|
|
gpointer * |
value, |
|
|
guint32 * |
value_len, |
|
|
JBatch * |
batch |
|
) |
| |
Get a key-value pair.
- Parameters
-
kv | A KV. |
value | A pointer for the returned value buffer. |
value_len | A pointer to the length of the returned value buffer. |
batch | A batch. |
◆ j_kv_get_backend()
Returns the kv backend.
- Returns
- The kv backend.
◆ j_kv_get_callback()
Get a key-value pair and execute a callback function once the pair is received.
- Parameters
-
kv | A key-value pair. |
func | The callback function. Will be called even if no KV is found (with value == NULL and len == 0). |
data | User defined data which will be passed to the callback function. |
batch | A batch. |
◆ j_kv_new()
JKV * j_kv_new |
( |
gchar const * |
namespace, |
|
|
gchar const * |
key |
|
) |
| |
Creates a new key-value pair.
JKV * j_kv_new(gchar const *namespace, gchar const *key)
Definition: jkv.c:525
- Parameters
-
namespace | Namespace to create the key-value pair in. |
key | A key-value pair key. |
- Returns
- A new key-value pair. Should be freed with j_kv_unref().
◆ j_kv_new_for_index()
JKV * j_kv_new_for_index |
( |
guint32 |
index, |
|
|
gchar const * |
namespace, |
|
|
gchar const * |
key |
|
) |
| |
Creates a new key-value pair on a specific KV-server.
JKV * j_kv_new_for_index(guint32 index, gchar const *namespace, gchar const *key)
Definition: jkv.c:545
- Parameters
-
index | Index of the KV-server where the key-value pair should be stored. |
namespace | Namespace to create the key-value pair in. |
key | A key-value pair key. |
- Returns
- A new key-value pair. Should be freed with j_kv_unref().
◆ j_kv_put()
void j_kv_put |
( |
JKV * |
kv, |
|
|
gpointer |
value, |
|
|
guint32 |
value_len, |
|
|
GDestroyNotify |
value_destroy, |
|
|
JBatch * |
batch |
|
) |
| |
Creates a key-value pair.
- Parameters
-
kv | A KV. |
value | A value. |
value_len | Length of value buffer. |
value_destroy | A function to correctly free the stored data. |
batch | A batch. |
- Todo:
- key = index + namespace
◆ j_kv_ref()
Increases a key-value pair's reference count.
JKV * j_kv_ref(JKV *kv)
Definition: jkv.c:566
- Parameters
-
- Returns
- key-value pair.
◆ j_kv_unref()
void j_kv_unref |
( |
JKV * |
kv | ) |
|
Decreases a key-value pair's reference count. When the reference count reaches zero, frees the memory allocated for the key-value pair.
- Parameters
-