Loading...
Searching...
No Matches
KeyValue store entries
Functions » KeyValue store

## Functions

NATS_EXTERN const char * | kvEntry_Bucket (kvEntry *e)
| Returns the name of the bucket the data was loaded from.
NATS_EXTERN const char * | kvEntry_Key (kvEntry *e)
| Returns the name of the key that was retrieved.
NATS_EXTERN const void * | kvEntry_Value (kvEntry *e)
| Returns the value for this key.
NATS_EXTERN int | kvEntry_ValueLen (kvEntry *e)
| Returns the value length for this key.
NATS_EXTERN const char * | kvEntry_ValueString (kvEntry *e)
| Returns the value, as a string, for this key.
NATS_EXTERN uint64_t | kvEntry_Revision (kvEntry *e)
| Returns the unique sequence for this value.
NATS_EXTERN int64_t | kvEntry_Created (kvEntry *e)
| Returns the time (in UTC) the data was put in the bucket.
NATS_EXTERN uint64_t | kvEntry_Delta (kvEntry *e)
| Returns the distance from the latest value.
NATS_EXTERN kvOperation | kvEntry_Operation (kvEntry *e)
| Returns the type of operation of this value.
NATS_EXTERN void | kvEntry_Destroy (kvEntry *e)
| Destroys the KeyValue entry object.

## Detailed Description

These functions allow to inspect a the value, or entry, of a given key.

Warning
  EXPERIMENTAL FEATURE! We reserve the right to change the API without necessarily bumping the major version of the library.

## Function Documentation

## kvEntry_Bucket()

NATS_EXTERN const char * kvEntry_Bucket | ( | kvEntry * | e | ) |

Returns the name of the bucket the data was loaded from, or `NULL` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Key()

NATS_EXTERN const char * kvEntry_Key | ( | kvEntry * | e | ) |

Returns the name of the key that was retrieved, or `NULL` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Value()

NATS_EXTERN const void * kvEntry_Value | ( | kvEntry * | e | ) |

Returns the value for this key, or `NULL` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_ValueLen()

NATS_EXTERN int kvEntry_ValueLen | ( | kvEntry * | e | ) |

Returns the value length for this key, or `-1` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_ValueString()

NATS_EXTERN const char * kvEntry_ValueString | ( | kvEntry * | e | ) |

If the value is an actual string, this call will return a NULL terminating string (`const char*`), or `NULL` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Revision()

NATS_EXTERN uint64_t kvEntry_Revision | ( | kvEntry * | e | ) |

Returns the unique sequence for this value, or `0` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Created()

NATS_EXTERN int64_t kvEntry_Created | ( | kvEntry * | e | ) |

Returns the time (in UTC) the data was put in the bucket, or `0` if `e` itself is `NULL`.

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Delta()

NATS_EXTERN uint64_t kvEntry_Delta | ( | kvEntry * | e | ) |

Returns the distance from the latest value, or `0` if `e` itself is `NULL`.

If history is enabled this is effectively the index of the historical value, 0 for latest, 1 for most recent etc...

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Operation()

NATS_EXTERN kvOperation kvEntry_Operation | ( | kvEntry * | e | ) |

Returns the type of operation of this value.

See also
  kvOperation

Parameters

  e | the pointer to the kvEntry object.

## kvEntry_Destroy()

NATS_EXTERN void kvEntry_Destroy | ( | kvEntry * | e | ) |

Releases memory allocated for this kvEntry object.

Parameters

  e | the pointer to the kvEntry object.