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.cache;
22 private static import groonga_d.groonga;
23 
24 extern(C):
25 nothrow @nogc:
26 
27 alias grn_db_create_optarg = _grn_db_create_optarg;
28 
29 struct _grn_db_create_optarg
30 {
31 	char** builtin_type_names;
32 	int n_builtin_type_names;
33 }
34 
35 //GRN_API
36 groonga_d.groonga.grn_obj* grn_db_create(groonga_d.groonga.grn_ctx* ctx, const (char)* path, grn_db_create_optarg* optarg);
37 
38 /+
39 #define GRN_DB_OPEN_OR_CREATE(ctx, path, optarg, db) (((db) = grn_db_open((ctx), (path))) || (db = grn_db_create((ctx), (path), (optarg))))
40 +/
41 
42 //GRN_API
43 groonga_d.groonga.grn_obj* grn_db_open(groonga_d.groonga.grn_ctx* ctx, const (char)* path);
44 
45 //GRN_API
46 void grn_db_touch(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
47 
48 //GRN_API
49 groonga_d.groonga.grn_rc grn_db_recover(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
50 
51 //GRN_API
52 groonga_d.groonga.grn_rc grn_db_unmap(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
53 
54 //GRN_API
55 uint grn_db_get_last_modified(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
56 
57 //GRN_API
58 groonga_d.groonga.grn_bool grn_db_is_dirty(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
59 
60 //GRN_API
61 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);
62 
63 //GRN_API
64 groonga_d.cache.grn_cache* grn_db_get_cache(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* db);
65 
66 /+
67 #define GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, flags) GRN_TABLE_EACH_BEGIN_FLAGS(ctx, grn_ctx_db((ctx)), cursor, id, flags)
68 
69 #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)
70 
71 #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)
72 
73 #define GRN_DB_EACH_END(ctx, cursor) GRN_TABLE_EACH_END(ctx, cursor)
74 +/