Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
hash.h File Reference
#include "groonga_in.h"
#include "ctx.h"
Include dependency graph for hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _grn_tiny_array
struct  _grn_tiny_bitmap
struct  _grn_array
struct  _grn_array_cursor
struct  _grn_table_queue
struct  _grn_hash
struct  grn_hash_header
struct  _grn_hash_cursor
struct  _grn_table_sort_optarg

Macros

#define GRN_TINY_ARRAY_CLEAR   (1 << 0)
#define GRN_TINY_ARRAY_THREADSAFE   (1 << 1)
#define GRN_TINY_ARRAY_USE_MALLOC   (1 << 2)
#define GRN_TINY_ARRAY_FACTOR   0
#define GRN_TINY_ARRAY_GET_OFFSET(block_id)   (1 << ((block_id) << GRN_TINY_ARRAY_FACTOR))
#define GRN_TINY_ARRAY_BASE_BLOCK_SIZE   (GRN_TINY_ARRAY_GET_OFFSET(1) - GRN_TINY_ARRAY_GET_OFFSET(0))
#define GRN_TINY_ARRAY_GET_BLOCK_SIZE(block_id)   (GRN_TINY_ARRAY_BASE_BLOCK_SIZE * GRN_TINY_ARRAY_GET_OFFSET(block_id))
#define GRN_TINY_ARRAY_NUM_BLOCKS   (32 >> GRN_TINY_ARRAY_FACTOR)
#define GRN_TINY_ARRAY_EACH(array, head, tail, key, value, block)
#define GRN_ARRAY_TINY   (0x01<<6)
#define GRN_ARRAY_SIZE(array)   (*((array)->n_entries))
#define GRN_HASH_TINY   (0x01<<6)
#define GRN_HASH_MAX_KEY_SIZE   GRN_TABLE_MAX_KEY_SIZE
#define GRN_TABLE_SORT_BY_KEY   0
#define GRN_TABLE_SORT_BY_ID   (1L<<1)
#define GRN_TABLE_SORT_BY_VALUE   (1L<<2)
#define GRN_TABLE_SORT_RES_ID   0
#define GRN_TABLE_SORT_RES_KEY   (1L<<3)
#define GRN_TABLE_SORT_AS_BIN   0
#define GRN_TABLE_SORT_AS_NUMBER   (1L<<4)
#define GRN_TABLE_SORT_AS_SIGNED   0
#define GRN_TABLE_SORT_AS_UNSIGNED   (1L<<5)
#define GRN_TABLE_SORT_AS_INT32   0
#define GRN_TABLE_SORT_AS_INT64   (1L<<6)
#define GRN_TABLE_SORT_NO_PROC   0
#define GRN_TABLE_SORT_WITH_PROC   (1L<<7)
#define GRN_HASH_SIZE(hash)   (*((hash)->n_entries))

Typedefs

typedef struct _grn_tiny_array grn_tiny_array
typedef struct _grn_tiny_bitmap grn_tiny_bitmap
typedef struct _grn_table_queue grn_table_queue
typedef struct
_grn_table_sort_optarg 
grn_table_sort_optarg

Enumerations

enum  grn_rec_unit {
  grn_rec_document = 0, grn_rec_section, grn_rec_position, grn_rec_userdef,
  grn_rec_none
}

Functions

GRN_API void grn_tiny_array_init (grn_ctx *ctx, grn_tiny_array *array, uint16_t element_size, uint16_t flags)
GRN_API void grn_tiny_array_fin (grn_tiny_array *array)
GRN_API void * grn_tiny_array_at (grn_tiny_array *array, grn_id id)
GRN_API grn_id grn_tiny_array_id (grn_tiny_array *array, const void *element_address)
grn_rc grn_array_truncate (grn_ctx *ctx, grn_array *array)
grn_rc grn_array_copy_sort_key (grn_ctx *ctx, grn_array *array, grn_table_sort_key *keys, int n_keys)
GRN_API void grn_array_queue_lock_clear (grn_ctx *ctx, grn_array *array)
GRN_API void grn_array_clear_curr_rec (grn_ctx *ctx, grn_array *array)
GRN_API grn_table_queuegrn_array_queue (grn_ctx *ctx, grn_array *array)
GRN_API uint32_t grn_table_queue_size (grn_table_queue *queue)
GRN_API void grn_table_queue_head_increment (grn_table_queue *queue)
GRN_API void grn_table_queue_tail_increment (grn_table_queue *queue)
GRN_API grn_id grn_table_queue_head (grn_table_queue *queue)
GRN_API grn_id grn_table_queue_tail (grn_table_queue *queue)
GRN_API int grn_hash_sort (grn_ctx *ctx, grn_hash *hash, int limit, grn_array *result, grn_table_sort_optarg *optarg)
grn_rc grn_hash_lock (grn_ctx *ctx, grn_hash *hash, int timeout)
grn_rc grn_hash_unlock (grn_ctx *ctx, grn_hash *hash)
grn_rc grn_hash_clear_lock (grn_ctx *ctx, grn_hash *hash)
GRN_API grn_rc grn_hash_truncate (grn_ctx *ctx, grn_hash *hash)
int grn_rec_unit_size (grn_rec_unit unit, int rec_size)
const char * _grn_hash_key (grn_ctx *ctx, grn_hash *hash, grn_id id, uint32_t *key_size)
int grn_hash_get_key_value (grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufsize, void *valuebuf)
int _grn_hash_get_key_value (grn_ctx *ctx, grn_hash *hash, grn_id id, void **key, void **value)
grn_id grn_hash_next (grn_ctx *ctx, grn_hash *hash, grn_id id)
const char * _grn_hash_strkey_by_val (void *v, uint16_t *size)
const char * grn_hash_get_value_ (grn_ctx *ctx, grn_hash *hash, grn_id id, uint32_t *size)
grn_rc grn_hash_remove (grn_ctx *ctx, const char *path)
grn_rc grn_array_remove (grn_ctx *ctx, const char *path)
grn_id grn_hash_at (grn_ctx *ctx, grn_hash *hash, grn_id id)
grn_id grn_array_at (grn_ctx *ctx, grn_array *array, grn_id id)
void grn_hash_check (grn_ctx *ctx, grn_hash *hash)

Macro Definition Documentation

#define GRN_ARRAY_SIZE (   array)    (*((array)->n_entries))

Definition at line 164 of file hash.h.

#define GRN_ARRAY_TINY   (0x01<<6)

Definition at line 123 of file hash.h.

#define GRN_HASH_MAX_KEY_SIZE   GRN_TABLE_MAX_KEY_SIZE

Definition at line 195 of file hash.h.

#define GRN_HASH_SIZE (   hash)    (*((hash)->n_entries))

Definition at line 304 of file hash.h.

#define GRN_HASH_TINY   (0x01<<6)

Definition at line 194 of file hash.h.

#define GRN_TABLE_SORT_AS_BIN   0

Definition at line 275 of file hash.h.

#define GRN_TABLE_SORT_AS_INT32   0

Definition at line 279 of file hash.h.

#define GRN_TABLE_SORT_AS_INT64   (1L<<6)

Definition at line 280 of file hash.h.

#define GRN_TABLE_SORT_AS_NUMBER   (1L<<4)

Definition at line 276 of file hash.h.

#define GRN_TABLE_SORT_AS_SIGNED   0

Definition at line 277 of file hash.h.

#define GRN_TABLE_SORT_AS_UNSIGNED   (1L<<5)

Definition at line 278 of file hash.h.

#define GRN_TABLE_SORT_BY_ID   (1L<<1)

Definition at line 271 of file hash.h.

#define GRN_TABLE_SORT_BY_KEY   0

Definition at line 270 of file hash.h.

#define GRN_TABLE_SORT_BY_VALUE   (1L<<2)

Definition at line 272 of file hash.h.

#define GRN_TABLE_SORT_NO_PROC   0

Definition at line 281 of file hash.h.

#define GRN_TABLE_SORT_RES_ID   0

Definition at line 273 of file hash.h.

#define GRN_TABLE_SORT_RES_KEY   (1L<<3)

Definition at line 274 of file hash.h.

#define GRN_TABLE_SORT_WITH_PROC   (1L<<7)

Definition at line 282 of file hash.h.

#define GRN_TINY_ARRAY_BASE_BLOCK_SIZE   (GRN_TINY_ARRAY_GET_OFFSET(1) - GRN_TINY_ARRAY_GET_OFFSET(0))

Definition at line 61 of file hash.h.

#define GRN_TINY_ARRAY_CLEAR   (1 << 0)

Definition at line 45 of file hash.h.

#define GRN_TINY_ARRAY_EACH (   array,
  head,
  tail,
  key,
  value,
  block 
)
Value:
do { \
int _block_id; \
const grn_id _head = (head); \
const grn_id _tail = (tail); \
for (_block_id = 0, (key) = (_head); \
_block_id < GRN_TINY_ARRAY_NUM_BLOCKS && (key) <= (_tail); \
_block_id++) { \
int _id = GRN_TINY_ARRAY_GET_BLOCK_SIZE(_block_id); \
(value) = (array)->blocks[_block_id]; \
if (value) { \
while (_id-- && (key) <= (_tail)) { \
{ \
block \
} \
(key)++; \
(value) = (void *)((byte *)(value) + (array)->element_size); \
} \
} else { \
(key) += _id; \
} \
} \
} while (0)

Definition at line 82 of file hash.h.

#define GRN_TINY_ARRAY_FACTOR   0

Definition at line 58 of file hash.h.

#define GRN_TINY_ARRAY_GET_BLOCK_SIZE (   block_id)    (GRN_TINY_ARRAY_BASE_BLOCK_SIZE * GRN_TINY_ARRAY_GET_OFFSET(block_id))

Definition at line 63 of file hash.h.

#define GRN_TINY_ARRAY_GET_OFFSET (   block_id)    (1 << ((block_id) << GRN_TINY_ARRAY_FACTOR))

Definition at line 59 of file hash.h.

#define GRN_TINY_ARRAY_NUM_BLOCKS   (32 >> GRN_TINY_ARRAY_FACTOR)

Definition at line 65 of file hash.h.

#define GRN_TINY_ARRAY_THREADSAFE   (1 << 1)

Definition at line 46 of file hash.h.

#define GRN_TINY_ARRAY_USE_MALLOC   (1 << 2)

Definition at line 47 of file hash.h.

Typedef Documentation

Definition at line 172 of file hash.h.

Definition at line 284 of file hash.h.

Definition at line 71 of file hash.h.

Definition at line 114 of file hash.h.

Enumeration Type Documentation

Enumerator:
grn_rec_document 
grn_rec_section 
grn_rec_position 
grn_rec_userdef 
grn_rec_none 

Definition at line 307 of file hash.h.

Function Documentation

int _grn_hash_get_key_value ( grn_ctx ctx,
grn_hash hash,
grn_id  id,
void **  key,
void **  value 
)

Definition at line 2363 of file hash.c.

Here is the caller graph for this function:

const char* _grn_hash_key ( grn_ctx ctx,
grn_hash hash,
grn_id  id,
uint32_t *  key_size 
)

Definition at line 2258 of file hash.c.

Here is the caller graph for this function:

const char* _grn_hash_strkey_by_val ( void *  v,
uint16_t *  size 
)

Definition at line 2518 of file hash.c.

grn_id grn_array_at ( grn_ctx ctx,
grn_array array,
grn_id  id 
)

Definition at line 842 of file hash.c.

Here is the caller graph for this function:

GRN_API void grn_array_clear_curr_rec ( grn_ctx ctx,
grn_array array 
)

Definition at line 1078 of file hash.c.

Here is the caller graph for this function:

grn_rc grn_array_copy_sort_key ( grn_ctx ctx,
grn_array array,
grn_table_sort_key keys,
int  n_keys 
)

Definition at line 859 of file hash.c.

GRN_API grn_table_queue* grn_array_queue ( grn_ctx ctx,
grn_array array 
)

Definition at line 535 of file hash.c.

Here is the call graph for this function:

Here is the caller graph for this function:

GRN_API void grn_array_queue_lock_clear ( grn_ctx ctx,
grn_array array 
)

Definition at line 527 of file hash.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_array_remove ( grn_ctx ctx,
const char *  path 
)

Definition at line 628 of file hash.c.

Here is the call graph for this function:

grn_rc grn_array_truncate ( grn_ctx ctx,
grn_array array 
)

Definition at line 635 of file hash.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_id grn_hash_at ( grn_ctx ctx,
grn_hash hash,
grn_id  id 
)

Definition at line 2633 of file hash.c.

Here is the caller graph for this function:

void grn_hash_check ( grn_ctx ctx,
grn_hash hash 
)

Definition at line 3055 of file hash.c.

Here is the call graph for this function:

grn_rc grn_hash_clear_lock ( grn_ctx ctx,
grn_hash hash 
)

Definition at line 2023 of file hash.c.

int grn_hash_get_key_value ( grn_ctx ctx,
grn_hash hash,
grn_id  id,
void *  keybuf,
int  bufsize,
void *  valuebuf 
)

Definition at line 2339 of file hash.c.

const char* grn_hash_get_value_ ( grn_ctx ctx,
grn_hash hash,
grn_id  id,
uint32_t *  size 
)

Definition at line 2323 of file hash.c.

Here is the caller graph for this function:

grn_rc grn_hash_lock ( grn_ctx ctx,
grn_hash hash,
int  timeout 
)

Definition at line 1987 of file hash.c.

Here is the call graph for this function:

grn_id grn_hash_next ( grn_ctx ctx,
grn_hash hash,
grn_id  id 
)

Definition at line 2623 of file hash.c.

Here is the caller graph for this function:

grn_rc grn_hash_remove ( grn_ctx ctx,
const char *  path 
)

Definition at line 1820 of file hash.c.

Here is the call graph for this function:

GRN_API int grn_hash_sort ( grn_ctx ctx,
grn_hash hash,
int  limit,
grn_array result,
grn_table_sort_optarg optarg 
)

Definition at line 2990 of file hash.c.

Here is the call graph for this function:

Here is the caller graph for this function:

GRN_API grn_rc grn_hash_truncate ( grn_ctx ctx,
grn_hash hash 
)

Definition at line 1827 of file hash.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_hash_unlock ( grn_ctx ctx,
grn_hash hash 
)

Definition at line 2015 of file hash.c.

int grn_rec_unit_size ( grn_rec_unit  unit,
int  rec_size 
)
GRN_API grn_id grn_table_queue_head ( grn_table_queue queue)

Definition at line 372 of file hash.c.

Here is the caller graph for this function:

GRN_API void grn_table_queue_head_increment ( grn_table_queue queue)

Definition at line 352 of file hash.c.

Here is the caller graph for this function:

GRN_API uint32_t grn_table_queue_size ( grn_table_queue queue)

Definition at line 344 of file hash.c.

Here is the caller graph for this function:

GRN_API grn_id grn_table_queue_tail ( grn_table_queue queue)

Definition at line 380 of file hash.c.

Here is the caller graph for this function:

GRN_API void grn_table_queue_tail_increment ( grn_table_queue queue)

Definition at line 362 of file hash.c.

Here is the caller graph for this function:

GRN_API void* grn_tiny_array_at ( grn_tiny_array array,
grn_id  id 
)

Definition at line 130 of file hash.c.

Here is the caller graph for this function:

GRN_API void grn_tiny_array_fin ( grn_tiny_array array)

Definition at line 113 of file hash.c.

Here is the caller graph for this function:

GRN_API grn_id grn_tiny_array_id ( grn_tiny_array array,
const void *  element_address 
)

Definition at line 136 of file hash.c.

Here is the caller graph for this function:

GRN_API void grn_tiny_array_init ( grn_ctx ctx,
grn_tiny_array array,
uint16_t  element_size,
uint16_t  flags 
)

Definition at line 99 of file hash.c.

Here is the caller graph for this function: