SOS: Scalable Object Store  4.0.0
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
ods_key_value_s Struct Reference

Implements the structure of a key. More...

#include <ods_idx.h>

Public Attributes

uint16_t len
 
unsigned char value [0]
 

Detailed Description

Implements the structure of a key.

A key is a counted array of bytes with the following format: struct ods_key_value { uint16_t len; unsigned char value[0]; }; The key is simply a special format for the value portion of an ODS object. A key can also be used as an argument to any function that otherwise takes an ods_obj_t.

Keys are ordered. A 'comparator' abstraction is used to define the order and equivalence of two keys. A comparator is defined by a name that indirectly identifies a shared library that implements the comparator function. There are a set of pre-defined comparator functions for which there are convenience macros to specify their names as follows:

  • ODS_KEY_STRING The key is a string. The strncmp function is used to compare the two keys. If the lengths of the two keys is not equal, but they are lexically equal, the function returns the difference in length between the two keys.
  • ODS_KEY_INT32 The key is a 32b signed integer; the comparator returns key_a - key_b.
  • ODS_KEY_UINT32 The key is a 32b unsigned int; the comparator returns key_a - key_b.
  • ODS_KEY_INT64 The key is a 32b signed long; the comparator returns key_a - key_b.
  • ODS_KEY_UINT64 The key is a 64b unsigned long; the comparator returns key_a - key_b.

These macros are used as parameters to the ods_idx_create() function when the index is created.


The documentation for this struct was generated from the following file: