1 /*
2   Copyright(C) 2009-2018 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 as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8 
9   This library is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Lesser General Public License for more details.
13 
14   You should have received a copy of the GNU Lesser General Public
15   License along with this library; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 module groonga_d.db;
19 
20 
21 private static import groonga_d.groonga;
22 
23 extern(C):
24 nothrow @nogc:
25 
26 alias grn_db_create_optarg = _grn_db_create_optarg;
27 
28 struct _grn_db_create_optarg
29 {
30 	char** builtin_type_names;
31 	int n_builtin_type_names;
32 }
33 
34 //GRN_API
35 groonga_d.groonga.grn_obj* grn_db_create(groonga_d.groonga.grn_ctx* ctx, const (char)* path, grn_db_create_optarg* optarg);
36 
37 /+
38 #define GRN_DB_OPEN_OR_CREATE(ctx, path, optarg, db) (((db) = grn_db_open((ctx), (path))) || (db = grn_db_create((ctx), (path), (optarg))))
39 +/
40 
41 //GRN_API
42 groonga_d.groonga.grn_obj* grn_db_open(groonga_d.groonga.grn_ctx* ctx, const (char)* path);
43 
44 //GRN_API
45 void grn_db_touch(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
46 
47 //GRN_API
48 groonga_d.groonga.grn_rc grn_db_recover(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
49 
50 //GRN_API
51 groonga_d.groonga.grn_rc grn_db_unmap(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
52 
53 //GRN_API
54 uint grn_db_get_last_modified(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
55 
56 //GRN_API
57 ubyte grn_db_is_dirty(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
58 
59 //GRN_API
60 groonga_d.groonga.grn_rc grn_db_set_cache(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db, groonga_d.cache.grn_cache* cache);
61 
62 //GRN_API
63 groonga_d.cache.grn_cache* grn_db_get_cache(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
64 
65 /+
66 #define GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, flags) GRN_TABLE_EACH_BEGIN_FLAGS(ctx, grn_ctx_db((ctx)), cursor, id, flags)
67 
68 #define GRN_DB_EACH_BEGIN_BY_ID(ctx, cursor, id) GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, GRN_CURSOR_BY_ID | GRN_CURSOR_ASCENDING)
69 
70 #define GRN_DB_EACH_BEGIN_BY_KEY(ctx, cursor, id) GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, GRN_CURSOR_BY_KEY | GRN_CURSOR_ASCENDING)
71 
72 #define GRN_DB_EACH_END(ctx, cursor) GRN_TABLE_EACH_END(ctx, cursor)
73 +/