Groonga 3.0.9 Source Code Document
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
groonga
lib
store.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 2 -*- */
2
/* Copyright(C) 2009-2012 Brazil
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License version 2.1 as published by the Free Software Foundation.
7
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Lesser General Public License for more details.
12
13
You should have received a copy of the GNU Lesser General Public
14
License along with this library; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
#ifndef GRN_STORE_H
18
#define GRN_STORE_H
19
20
#ifndef GROONGA_IN_H
21
#include "
groonga_in.h
"
22
#endif
/* GROONGA_IN_H */
23
24
#ifndef GRN_CTX_H
25
#include "
ctx.h
"
26
#endif
/* GRN_CTX_H */
27
28
#ifndef GRN_HASH_H
29
#include "
hash.h
"
30
#endif
/* GRN_HASH_H */
31
32
#ifndef GRN_IO_H
33
#include "
io.h
"
34
#endif
/* GRN_IO_H */
35
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
39
40
/**** fixed sized elements ****/
41
42
typedef
struct
_grn_ra
grn_ra
;
43
44
struct
_grn_ra
{
45
grn_db_obj
obj
;
46
grn_io
*
io
;
47
int
element_width
;
48
int
element_mask
;
49
struct
grn_ra_header
*
header
;
50
};
51
52
struct
grn_ra_header
{
53
uint32_t
element_size
;
54
uint32_t
nrecords
;
/* nrecords is not maintained by default */
55
uint32_t
reserved
[10];
56
};
57
58
grn_ra
*
grn_ra_create
(
grn_ctx
*ctx,
const
char
*path,
unsigned
int
element_size);
59
grn_ra
*
grn_ra_open
(
grn_ctx
*ctx,
const
char
*path);
60
grn_rc
grn_ra_info
(
grn_ctx
*ctx,
grn_ra
*ra,
unsigned
int
*element_size);
61
grn_rc
grn_ra_close
(
grn_ctx
*ctx,
grn_ra
*ra);
62
grn_rc
grn_ra_remove
(
grn_ctx
*ctx,
const
char
*path);
63
void
*
grn_ra_ref
(
grn_ctx
*ctx,
grn_ra
*ra,
grn_id
id
);
64
grn_rc
grn_ra_unref
(
grn_ctx
*ctx,
grn_ra
*ra,
grn_id
id
);
65
66
typedef
struct
_grn_ra_cache
grn_ra_cache
;
67
68
struct
_grn_ra_cache
{
69
void
*
p
;
70
int32_t
seg
;
71
};
72
73
#define GRN_RA_CACHE_INIT(ra,c) do {\
74
(c)->p = NULL; (c)->seg = -1;\
75
} while (0)
76
77
#define GRN_RA_CACHE_FIN(ra,c) do {\
78
if ((c)->seg != -1) { GRN_IO_SEG_UNREF((ra)->io, (c)->seg); }\
79
} while (0);
80
81
void
*
grn_ra_ref_cache
(
grn_ctx
*ctx,
grn_ra
*ra,
grn_id
id
,
grn_ra_cache
*cache);
82
83
/**** variable sized elements ****/
84
85
extern
grn_bool
grn_ja_skip_same_value_put
;
86
87
typedef
struct
_grn_ja
grn_ja
;
88
89
struct
_grn_ja
{
90
grn_db_obj
obj
;
91
grn_io
*
io
;
92
struct
grn_ja_header
*
header
;
93
};
94
95
GRN_API
grn_ja
*
grn_ja_create
(
grn_ctx
*ctx,
const
char
*path,
96
uint32_t
max_element_size
, uint32_t
flags
);
97
grn_ja
*
grn_ja_open
(
grn_ctx
*ctx,
const
char
*path);
98
grn_rc
grn_ja_info
(
grn_ctx
*ctx,
grn_ja
*ja,
unsigned
int
*
max_element_size
);
99
GRN_API
grn_rc
grn_ja_close
(
grn_ctx
*ctx,
grn_ja
*ja);
100
grn_rc
grn_ja_remove
(
grn_ctx
*ctx,
const
char
*path);
101
grn_rc
grn_ja_put
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
,
102
void
*value, uint32_t value_len,
int
flags
, uint64_t *cas);
103
int
grn_ja_at
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
,
void
*valbuf,
int
buf_size);
104
105
GRN_API
void
*
grn_ja_ref
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
,
grn_io_win
*iw,
106
uint32_t *value_len);
107
grn_obj
*
grn_ja_get_value
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
,
grn_obj
*value);
108
109
GRN_API
grn_rc
grn_ja_unref
(
grn_ctx
*ctx,
grn_io_win
*iw);
110
int
grn_ja_defrag
(
grn_ctx
*ctx,
grn_ja
*ja,
int
threshold);
111
112
GRN_API
grn_rc
grn_ja_putv
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
,
113
grn_obj
*vector,
int
flags
);
114
GRN_API
uint32_t
grn_ja_size
(
grn_ctx
*ctx,
grn_ja
*ja,
grn_id
id
);
115
116
void
grn_ja_check
(
grn_ctx
*ctx,
grn_ja
*ja);
117
118
/*
119
120
typedef struct _grn_vgram_vnode
121
{
122
struct _grn_vgram_vnode *car;
123
struct _grn_vgram_vnode *cdr;
124
grn_id tid;
125
grn_id vid;
126
int freq;
127
int len;
128
} grn_vgram_vnode;
129
130
typedef struct _grn_vgram grn_vgram;
131
struct _grn_vgram {
132
void *vgram;
133
};
134
135
struct _grn_vgram_buf {
136
size_t len;
137
grn_id *tvs;
138
grn_id *tvp;
139
grn_id *tve;
140
grn_vgram_vnode *vps;
141
grn_vgram_vnode *vpp;
142
grn_vgram_vnode *vpe;
143
};
144
145
grn_vgram *grn_vgram_create(const char *path);
146
grn_vgram *grn_vgram_open(const char *path);
147
grn_rc grn_vgram_close(grn_vgram *vgram);
148
grn_rc grn_vgram_update(grn_vgram *vgram, grn_id rid, grn_vgram_buf *b, grn_hash *terms);
149
150
grn_vgram_buf *grn_vgram_buf_open(size_t len);
151
grn_rc grn_vgram_buf_add(grn_vgram_buf *b, grn_id tid);
152
grn_rc grn_vgram_buf_close(grn_vgram_buf *b);
153
154
*/
155
156
#ifdef __cplusplus
157
}
158
#endif
159
160
#endif
/* GRN_STORE_H */
Generated on Sun Nov 10 2013 09:49:04 for Groonga 3.0.9 Source Code Document by
1.8.1.2