Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Typedefs | Functions | Variables
store.c File Reference
#include "groonga_in.h"
#include "str.h"
#include "store.h"
#include "ctx_impl.h"
#include "output.h"
#include <string.h>
Include dependency graph for store.c:

Go to the source code of this file.

Data Structures

struct  _grn_ja_einfo
struct  ja_pos
struct  grn_ja_ginfo
struct  grn_ja_header

Macros

#define GRN_RA_SEGMENT_SIZE   (1 << 22)
#define GRN_JA_W_SEGREGATE_THRESH   7
#define GRN_JA_W_CAPACITY   38
#define GRN_JA_W_SEGMENT   22
#define JA_ESEG_VOID   (0xffffffffU)
#define JA_SEGMENT_SIZE   (1U << GRN_JA_W_SEGMENT)
#define JA_W_EINFO   3
#define JA_W_SEGMENTS_MAX   (GRN_JA_W_CAPACITY - GRN_JA_W_SEGMENT)
#define JA_W_EINFO_IN_A_SEGMENT   (GRN_JA_W_SEGMENT - JA_W_EINFO)
#define JA_N_EINFO_IN_A_SEGMENT   (1U << JA_W_EINFO_IN_A_SEGMENT)
#define JA_M_EINFO_IN_A_SEGMENT   (JA_N_EINFO_IN_A_SEGMENT - 1)
#define JA_N_GARBAGES_IN_A_SEGMENT   ((1U << (GRN_JA_W_SEGMENT - 3)) - 2)
#define JA_N_ELEMENT_VARIATION   (GRN_JA_W_SEGREGATE_THRESH - JA_W_EINFO + 1)
#define JA_N_DSEGMENTS   (1U << JA_W_SEGMENTS_MAX)
#define JA_N_ESEGMENTS   (1U << (GRN_ID_WIDTH - JA_W_EINFO_IN_A_SEGMENT))
#define ETINY   (0x80)
#define EHUGE   (0x40)
#define ETINY_P(e)   ((e)->u.c[7] & ETINY)
#define ETINY_ENC(e, _size)   ((e)->u.c[7] = (_size) + ETINY)
#define ETINY_DEC(e, _size)   ((_size) = (e)->u.c[7] & ~(ETINY|EHUGE))
#define EHUGE_P(e)   ((e)->u.c[7] & EHUGE)
#define EHUGE_ENC(e, _seg, _size)
#define EHUGE_DEC(e, _seg, _size)
#define EINFO_ENC(e, _seg, _pos, _size)
#define EINFO_DEC(e, _seg, _pos, _size)
#define SEG_SEQ   (0x10000000U)
#define SEG_HUGE   (0x20000000U)
#define SEG_EINFO   (0x30000000U)
#define SEG_GINFO   (0x40000000U)
#define SEG_MASK   (0xf0000000U)
#define SEGMENTS_AT(ja, seg)   ((ja)->header->dsegs[seg])
#define SEGMENTS_SEGRE_ON(ja, seg, width)   (SEGMENTS_AT(ja,seg) = width)
#define SEGMENTS_SEQ_ON(ja, seg)   (SEGMENTS_AT(ja,seg) = SEG_SEQ)
#define SEGMENTS_HUGE_ON(ja, seg)   (SEGMENTS_AT(ja,seg) = SEG_HUGE)
#define SEGMENTS_EINFO_ON(ja, seg, lseg)   (SEGMENTS_AT(ja,seg) = SEG_EINFO|(lseg))
#define SEGMENTS_GINFO_ON(ja, seg, width)   (SEGMENTS_AT(ja,seg) = SEG_GINFO|(width))
#define SEGMENTS_OFF(ja, seg)   (SEGMENTS_AT(ja,seg) = 0)
#define DELETED   0x80000000
#define JA_N_GARBAGES_TH   10

Typedefs

typedef struct _grn_ja_einfo grn_ja_einfo

Functions

grn_ragrn_ra_create (grn_ctx *ctx, const char *path, unsigned int element_size)
grn_ragrn_ra_open (grn_ctx *ctx, const char *path)
grn_rc grn_ra_info (grn_ctx *ctx, grn_ra *ra, unsigned int *element_size)
grn_rc grn_ra_close (grn_ctx *ctx, grn_ra *ra)
grn_rc grn_ra_remove (grn_ctx *ctx, const char *path)
grn_rc grn_ra_truncate (grn_ctx *ctx, grn_ra *ra)
void * grn_ra_ref (grn_ctx *ctx, grn_ra *ra, grn_id id)
grn_rc grn_ra_unref (grn_ctx *ctx, grn_ra *ra, grn_id id)
void * grn_ra_ref_cache (grn_ctx *ctx, grn_ra *ra, grn_id id, grn_ra_cache *cache)
grn_rc grn_ra_cache_fin (grn_ctx *ctx, grn_ra *ra, grn_id id)
grn_jagrn_ja_create (grn_ctx *ctx, const char *path, unsigned int max_element_size, uint32_t flags)
grn_jagrn_ja_open (grn_ctx *ctx, const char *path)
grn_rc grn_ja_info (grn_ctx *ctx, grn_ja *ja, unsigned int *max_element_size)
grn_rc grn_ja_close (grn_ctx *ctx, grn_ja *ja)
grn_rc grn_ja_remove (grn_ctx *ctx, const char *path)
grn_rc grn_ja_truncate (grn_ctx *ctx, grn_ja *ja)
grn_rc grn_ja_unref (grn_ctx *ctx, grn_io_win *iw)
grn_rc grn_ja_replace (grn_ctx *ctx, grn_ja *ja, grn_id id, grn_ja_einfo *ei, uint64_t *cas)
grn_rc grn_ja_put_raw (grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len, int flags, uint64_t *cas)
grn_rc grn_ja_putv (grn_ctx *ctx, grn_ja *ja, grn_id id, grn_obj *vector, int flags)
uint32_t grn_ja_size (grn_ctx *ctx, grn_ja *ja, grn_id id)
grn_rc grn_ja_element_info (grn_ctx *ctx, grn_ja *ja, grn_id id, uint64_t *cas, uint32_t *pos, uint32_t *size)
void * grn_ja_ref (grn_ctx *ctx, grn_ja *ja, grn_id id, grn_io_win *iw, uint32_t *value_len)
grn_objgrn_ja_get_value (grn_ctx *ctx, grn_ja *ja, grn_id id, grn_obj *value)
grn_rc grn_ja_put (grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len, int flags, uint64_t *cas)
int grn_ja_defrag (grn_ctx *ctx, grn_ja *ja, int threshold)
void grn_ja_check (grn_ctx *ctx, grn_ja *ja)

Variables

grn_bool grn_ja_skip_same_value_put = GRN_FALSE

Macro Definition Documentation

#define DELETED   0x80000000

Definition at line 475 of file store.c.

#define EHUGE   (0x40)

Definition at line 244 of file store.c.

#define EHUGE_DEC (   e,
  _seg,
  _size 
)
Value:
do {\
(_seg) = (e)->u.h.seg;\
(_size) = (e)->u.h.size;\
} while (0)

Definition at line 255 of file store.c.

#define EHUGE_ENC (   e,
  _seg,
  _size 
)
Value:
do {\
(e)->u.h.c1 = 0;\
(e)->u.h.c2 = EHUGE;\
(e)->u.h.seg = (_seg);\
(e)->u.h.size = (_size);\
} while (0)

Definition at line 249 of file store.c.

#define EHUGE_P (   e)    ((e)->u.c[7] & EHUGE)

Definition at line 248 of file store.c.

#define EINFO_DEC (   e,
  _seg,
  _pos,
  _size 
)
Value:
do {\
(_seg) = (e)->u.n.seg;\
(_pos) = ((e)->u.n.c1 << 16) + (e)->u.n.pos;\
(_size) = ((e)->u.n.c2 << 16) + (e)->u.n.size;\
} while (0)

Definition at line 266 of file store.c.

#define EINFO_ENC (   e,
  _seg,
  _pos,
  _size 
)
Value:
do {\
(e)->u.n.c1 = (_pos) >> 16;\
(e)->u.n.c2 = ((_size) >> 16);\
(e)->u.n.seg = (_seg);\
(e)->u.n.pos = (_pos);\
(e)->u.n.size = (_size);\
} while (0)

Definition at line 259 of file store.c.

#define ETINY   (0x80)

Definition at line 243 of file store.c.

#define ETINY_DEC (   e,
  _size 
)    ((_size) = (e)->u.c[7] & ~(ETINY|EHUGE))

Definition at line 247 of file store.c.

#define ETINY_ENC (   e,
  _size 
)    ((e)->u.c[7] = (_size) + ETINY)

Definition at line 246 of file store.c.

#define ETINY_P (   e)    ((e)->u.c[7] & ETINY)

Definition at line 245 of file store.c.

#define GRN_JA_W_CAPACITY   38

Definition at line 207 of file store.c.

#define GRN_JA_W_SEGMENT   22

Definition at line 208 of file store.c.

#define GRN_JA_W_SEGREGATE_THRESH   7

Definition at line 206 of file store.c.

#define GRN_RA_SEGMENT_SIZE   (1 << 22)

Definition at line 26 of file store.c.

#define JA_ESEG_VOID   (0xffffffffU)

Definition at line 210 of file store.c.

#define JA_M_EINFO_IN_A_SEGMENT   (JA_N_EINFO_IN_A_SEGMENT - 1)

Definition at line 216 of file store.c.

#define JA_N_DSEGMENTS   (1U << JA_W_SEGMENTS_MAX)

Definition at line 219 of file store.c.

#define JA_N_EINFO_IN_A_SEGMENT   (1U << JA_W_EINFO_IN_A_SEGMENT)

Definition at line 215 of file store.c.

#define JA_N_ELEMENT_VARIATION   (GRN_JA_W_SEGREGATE_THRESH - JA_W_EINFO + 1)

Definition at line 218 of file store.c.

#define JA_N_ESEGMENTS   (1U << (GRN_ID_WIDTH - JA_W_EINFO_IN_A_SEGMENT))

Definition at line 220 of file store.c.

#define JA_N_GARBAGES_IN_A_SEGMENT   ((1U << (GRN_JA_W_SEGMENT - 3)) - 2)

Definition at line 217 of file store.c.

#define JA_N_GARBAGES_TH   10

Definition at line 616 of file store.c.

#define JA_SEGMENT_SIZE   (1U << GRN_JA_W_SEGMENT)

Definition at line 211 of file store.c.

#define JA_W_EINFO   3

Definition at line 212 of file store.c.

#define JA_W_EINFO_IN_A_SEGMENT   (GRN_JA_W_SEGMENT - JA_W_EINFO)

Definition at line 214 of file store.c.

#define JA_W_SEGMENTS_MAX   (GRN_JA_W_CAPACITY - GRN_JA_W_SEGMENT)

Definition at line 213 of file store.c.

#define SEG_EINFO   (0x30000000U)

Definition at line 299 of file store.c.

#define SEG_GINFO   (0x40000000U)

Definition at line 300 of file store.c.

#define SEG_HUGE   (0x20000000U)

Definition at line 298 of file store.c.

#define SEG_MASK   (0xf0000000U)

Definition at line 301 of file store.c.

#define SEG_SEQ   (0x10000000U)

Definition at line 297 of file store.c.

#define SEGMENTS_AT (   ja,
  seg 
)    ((ja)->header->dsegs[seg])

Definition at line 303 of file store.c.

#define SEGMENTS_EINFO_ON (   ja,
  seg,
  lseg 
)    (SEGMENTS_AT(ja,seg) = SEG_EINFO|(lseg))

Definition at line 307 of file store.c.

#define SEGMENTS_GINFO_ON (   ja,
  seg,
  width 
)    (SEGMENTS_AT(ja,seg) = SEG_GINFO|(width))

Definition at line 308 of file store.c.

#define SEGMENTS_HUGE_ON (   ja,
  seg 
)    (SEGMENTS_AT(ja,seg) = SEG_HUGE)

Definition at line 306 of file store.c.

#define SEGMENTS_OFF (   ja,
  seg 
)    (SEGMENTS_AT(ja,seg) = 0)

Definition at line 309 of file store.c.

#define SEGMENTS_SEGRE_ON (   ja,
  seg,
  width 
)    (SEGMENTS_AT(ja,seg) = width)

Definition at line 304 of file store.c.

#define SEGMENTS_SEQ_ON (   ja,
  seg 
)    (SEGMENTS_AT(ja,seg) = SEG_SEQ)

Definition at line 305 of file store.c.

Typedef Documentation

typedef struct _grn_ja_einfo grn_ja_einfo

Definition at line 222 of file store.c.

Function Documentation

void grn_ja_check ( grn_ctx ctx,
grn_ja ja 
)

Definition at line 1363 of file store.c.

Here is the call graph for this function:

grn_rc grn_ja_close ( grn_ctx ctx,
grn_ja ja 
)

Definition at line 385 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_ja* grn_ja_create ( grn_ctx ctx,
const char *  path,
unsigned int  max_element_size,
uint32_t  flags 
)

Definition at line 338 of file store.c.

Here is the caller graph for this function:

int grn_ja_defrag ( grn_ctx ctx,
grn_ja ja,
int  threshold 
)

Definition at line 1348 of file store.c.

Here is the caller graph for this function:

grn_rc grn_ja_element_info ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
uint64_t *  cas,
uint32_t *  pos,
uint32_t *  size 
)

Definition at line 1049 of file store.c.

grn_obj* grn_ja_get_value ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
grn_obj value 
)

Definition at line 1183 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ja_info ( grn_ctx ctx,
grn_ja ja,
unsigned int *  max_element_size 
)

Definition at line 377 of file store.c.

grn_ja* grn_ja_open ( grn_ctx ctx,
const char *  path 
)

Definition at line 353 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ja_put ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
void *  value,
uint32_t  value_len,
int  flags,
uint64_t *  cas 
)

Definition at line 1290 of file store.c.

Here is the call graph for this function:

grn_rc grn_ja_put_raw ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
void *  value,
uint32_t  value_len,
int  flags,
uint64_t *  cas 
)

Definition at line 798 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ja_putv ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
grn_obj vector,
int  flags 
)

Definition at line 978 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void* grn_ja_ref ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
grn_io_win iw,
uint32_t *  value_len 
)

Definition at line 1167 of file store.c.

Here is the caller graph for this function:

grn_rc grn_ja_remove ( grn_ctx ctx,
const char *  path 
)

Definition at line 395 of file store.c.

Here is the call graph for this function:

grn_rc grn_ja_replace ( grn_ctx ctx,
grn_ja ja,
grn_id  id,
grn_ja_einfo ei,
uint64_t *  cas 
)

Definition at line 562 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t grn_ja_size ( grn_ctx ctx,
grn_ja ja,
grn_id  id 
)

Definition at line 1018 of file store.c.

Here is the caller graph for this function:

grn_rc grn_ja_truncate ( grn_ctx ctx,
grn_ja ja 
)

Definition at line 402 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ja_unref ( grn_ctx ctx,
grn_io_win iw 
)

Definition at line 467 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ra_cache_fin ( grn_ctx ctx,
grn_ra ra,
grn_id  id 
)

Definition at line 195 of file store.c.

grn_rc grn_ra_close ( grn_ctx ctx,
grn_ra ra 
)

Definition at line 110 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_ra* grn_ra_create ( grn_ctx ctx,
const char *  path,
unsigned int  element_size 
)

Definition at line 58 of file store.c.

Here is the caller graph for this function:

grn_rc grn_ra_info ( grn_ctx ctx,
grn_ra ra,
unsigned int *  element_size 
)

Definition at line 102 of file store.c.

grn_ra* grn_ra_open ( grn_ctx ctx,
const char *  path 
)

Definition at line 73 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void* grn_ra_ref ( grn_ctx ctx,
grn_ra ra,
grn_id  id 
)

Definition at line 154 of file store.c.

Here is the caller graph for this function:

void* grn_ra_ref_cache ( grn_ctx ctx,
grn_ra ra,
grn_id  id,
grn_ra_cache cache 
)

Definition at line 176 of file store.c.

Here is the caller graph for this function:

grn_rc grn_ra_remove ( grn_ctx ctx,
const char *  path 
)

Definition at line 120 of file store.c.

Here is the call graph for this function:

grn_rc grn_ra_truncate ( grn_ctx ctx,
grn_ra ra 
)

Definition at line 127 of file store.c.

Here is the call graph for this function:

Here is the caller graph for this function:

grn_rc grn_ra_unref ( grn_ctx ctx,
grn_ra ra,
grn_id  id 
)

Definition at line 166 of file store.c.

Here is the caller graph for this function:

Variable Documentation

grn_bool grn_ja_skip_same_value_put = GRN_FALSE

Definition at line 311 of file store.c.