Groonga
Loading...
Searching...
No Matches
hash.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRN_HASH_TINY   (0x01 << 6)
#define GRN_HASH_EACH(ctx, hash, id, key, key_size, value, block)
#define GRN_HASH_EACH_BEGIN(ctx, hash, cursor, id)
#define GRN_HASH_EACH_END(ctx, cursor)

Typedefs

typedef struct _grn_hash grn_hash
typedef struct _grn_hash_cursor grn_hash_cursor

Functions

GRN_API grn_hash * grn_hash_create (grn_ctx *ctx, const char *path, unsigned int key_size, unsigned int value_size, unsigned int flags)
GRN_API grn_hash * grn_hash_open (grn_ctx *ctx, const char *path)
GRN_API grn_rc grn_hash_close (grn_ctx *ctx, grn_hash *hash)
GRN_API grn_id grn_hash_add (grn_ctx *ctx, grn_hash *hash, const void *key, unsigned int key_size, void **value, int *added)
GRN_API grn_id grn_hash_get (grn_ctx *ctx, grn_hash *hash, const void *key, unsigned int key_size, void **value)
GRN_API int grn_hash_get_key (grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufsize)
GRN_API int grn_hash_get_key2 (grn_ctx *ctx, grn_hash *hash, grn_id id, grn_obj *bulk)
GRN_API int grn_hash_get_value (grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf)
GRN_API grn_rc grn_hash_set_value (grn_ctx *ctx, grn_hash *hash, grn_id id, const void *value, int flags)
GRN_API grn_rc grn_hash_delete_by_id (grn_ctx *ctx, grn_hash *hash, grn_id id, grn_table_delete_optarg *optarg)
GRN_API grn_rc grn_hash_delete (grn_ctx *ctx, grn_hash *hash, const void *key, unsigned int key_size, grn_table_delete_optarg *optarg)
GRN_API uint32_t grn_hash_size (grn_ctx *ctx, grn_hash *hash)
GRN_API grn_hash_cursor * grn_hash_cursor_open (grn_ctx *ctx, grn_hash *hash, const void *min, unsigned int min_size, const void *max, unsigned int max_size, int offset, int limit, int flags)
GRN_API grn_id grn_hash_cursor_next (grn_ctx *ctx, grn_hash_cursor *c)
GRN_API void grn_hash_cursor_close (grn_ctx *ctx, grn_hash_cursor *c)
GRN_API int grn_hash_cursor_get_key (grn_ctx *ctx, grn_hash_cursor *c, void **key)
GRN_API int grn_hash_cursor_get_value (grn_ctx *ctx, grn_hash_cursor *c, void **value)
GRN_API grn_rc grn_hash_cursor_set_value (grn_ctx *ctx, grn_hash_cursor *c, const void *value, int flags)
GRN_API int grn_hash_cursor_get_key_value (grn_ctx *ctx, grn_hash_cursor *c, void **key, unsigned int *key_size, void **value)
GRN_API grn_rc grn_hash_cursor_delete (grn_ctx *ctx, grn_hash_cursor *c, grn_table_delete_optarg *optarg)

Macro Definition Documentation

◆ GRN_HASH_EACH

#define GRN_HASH_EACH ( ctx,
hash,
id,
key,
key_size,
value,
block )
Value:
do { \
grn_hash_cursor *_sc = NULL; \
if (hash && grn_hash_size(ctx, hash) > 0) { \
_sc = grn_hash_cursor_open(ctx, hash, NULL, 0, NULL, 0, 0, -1, 0); \
} \
if (_sc) { \
grn_id id; \
while ((id = grn_hash_cursor_next(ctx, _sc))) { \
grn_hash_cursor_get_key_value(ctx, \
_sc, \
(void **)(key), \
(key_size), \
(void **)(value)); \
block \
} \
grn_hash_cursor_close(ctx, _sc); \
} \
} while (0)
uint32_t grn_id
Definition groonga.h:44
GRN_API uint32_t grn_hash_size(grn_ctx *ctx, grn_hash *hash)
GRN_API grn_hash_cursor * grn_hash_cursor_open(grn_ctx *ctx, grn_hash *hash, const void *min, unsigned int min_size, const void *max, unsigned int max_size, int offset, int limit, int flags)
struct _grn_hash_cursor grn_hash_cursor
Definition hash.h:29
GRN_API grn_id grn_hash_cursor_next(grn_ctx *ctx, grn_hash_cursor *c)

◆ GRN_HASH_EACH_BEGIN

#define GRN_HASH_EACH_BEGIN ( ctx,
hash,
cursor,
id )
Value:
do { \
grn_hash_cursor *cursor = NULL; \
if (hash && grn_hash_size(ctx, hash) > 0) { \
cursor = grn_hash_cursor_open((ctx), \
(hash), \
NULL, \
0, \
NULL, \
0, \
0, \
-1, \
} \
if (cursor) { \
grn_id id; \
while ((id = grn_hash_cursor_next((ctx), cursor)) != GRN_ID_NIL) {
#define GRN_ID_NIL
Means "does not exist".
Definition groonga.h:55
#define GRN_CURSOR_BY_ID
Definition table.h:280

◆ GRN_HASH_EACH_END

#define GRN_HASH_EACH_END ( ctx,
cursor )
Value:
} \
grn_hash_cursor_close((ctx), cursor); \
} \
} \
while (0)

◆ GRN_HASH_TINY

#define GRN_HASH_TINY   (0x01 << 6)

Typedef Documentation

◆ grn_hash

typedef struct _grn_hash grn_hash

◆ grn_hash_cursor

typedef struct _grn_hash_cursor grn_hash_cursor

Function Documentation

◆ grn_hash_add()

GRN_API grn_id grn_hash_add ( grn_ctx * ctx,
grn_hash * hash,
const void * key,
unsigned int key_size,
void ** value,
int * added )

◆ grn_hash_close()

GRN_API grn_rc grn_hash_close ( grn_ctx * ctx,
grn_hash * hash )

◆ grn_hash_create()

GRN_API grn_hash * grn_hash_create ( grn_ctx * ctx,
const char * path,
unsigned int key_size,
unsigned int value_size,
unsigned int flags )

◆ grn_hash_cursor_close()

GRN_API void grn_hash_cursor_close ( grn_ctx * ctx,
grn_hash_cursor * c )

◆ grn_hash_cursor_delete()

GRN_API grn_rc grn_hash_cursor_delete ( grn_ctx * ctx,
grn_hash_cursor * c,
grn_table_delete_optarg * optarg )

◆ grn_hash_cursor_get_key()

GRN_API int grn_hash_cursor_get_key ( grn_ctx * ctx,
grn_hash_cursor * c,
void ** key )

◆ grn_hash_cursor_get_key_value()

GRN_API int grn_hash_cursor_get_key_value ( grn_ctx * ctx,
grn_hash_cursor * c,
void ** key,
unsigned int * key_size,
void ** value )

◆ grn_hash_cursor_get_value()

GRN_API int grn_hash_cursor_get_value ( grn_ctx * ctx,
grn_hash_cursor * c,
void ** value )

◆ grn_hash_cursor_next()

GRN_API grn_id grn_hash_cursor_next ( grn_ctx * ctx,
grn_hash_cursor * c )

◆ grn_hash_cursor_open()

GRN_API grn_hash_cursor * grn_hash_cursor_open ( grn_ctx * ctx,
grn_hash * hash,
const void * min,
unsigned int min_size,
const void * max,
unsigned int max_size,
int offset,
int limit,
int flags )

◆ grn_hash_cursor_set_value()

GRN_API grn_rc grn_hash_cursor_set_value ( grn_ctx * ctx,
grn_hash_cursor * c,
const void * value,
int flags )

◆ grn_hash_delete()

GRN_API grn_rc grn_hash_delete ( grn_ctx * ctx,
grn_hash * hash,
const void * key,
unsigned int key_size,
grn_table_delete_optarg * optarg )

◆ grn_hash_delete_by_id()

GRN_API grn_rc grn_hash_delete_by_id ( grn_ctx * ctx,
grn_hash * hash,
grn_id id,
grn_table_delete_optarg * optarg )

◆ grn_hash_get()

GRN_API grn_id grn_hash_get ( grn_ctx * ctx,
grn_hash * hash,
const void * key,
unsigned int key_size,
void ** value )

◆ grn_hash_get_key()

GRN_API int grn_hash_get_key ( grn_ctx * ctx,
grn_hash * hash,
grn_id id,
void * keybuf,
int bufsize )

◆ grn_hash_get_key2()

GRN_API int grn_hash_get_key2 ( grn_ctx * ctx,
grn_hash * hash,
grn_id id,
grn_obj * bulk )

◆ grn_hash_get_value()

GRN_API int grn_hash_get_value ( grn_ctx * ctx,
grn_hash * hash,
grn_id id,
void * valuebuf )

◆ grn_hash_open()

GRN_API grn_hash * grn_hash_open ( grn_ctx * ctx,
const char * path )

◆ grn_hash_set_value()

GRN_API grn_rc grn_hash_set_value ( grn_ctx * ctx,
grn_hash * hash,
grn_id id,
const void * value,
int flags )

◆ grn_hash_size()

GRN_API uint32_t grn_hash_size ( grn_ctx * ctx,
grn_hash * hash )