Debian Codegraph @

lib/grn_table.h

raw symbols SCIP
1 /*
2 Copyright (C) 2018 Brazil
3 Copyright (C) 2019-2024 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #pragma once
21
22 #include "grn.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 double
29 grn_table_get_score(grn_ctx *ctx, grn_obj *table, grn_id id);
30
31 grn_obj *
32 grn_table_create_with_max_n_subrecs(grn_ctx *ctx,
33 const char *name,
34 unsigned int name_size,
35 const char *path,
36 grn_table_flags flags,
37 grn_obj *key_type,
38 grn_obj *value_type,
39 uint32_t max_n_subrecs,
40 uint32_t additional_value_size);
41
42 grn_rc
43 grn_table_setoperation_with_weight_factor(grn_ctx *ctx,
44 grn_obj *table1,
45 grn_obj *table2,
46 grn_obj *res,
47 grn_operator op,
48 float weight_factor);
49
50 grn_id
51 grn_table_find_reference_object_raw(grn_ctx *ctx, grn_id table_id);
52
53 grn_hash *
54 grn_table_all_columns(grn_ctx *ctx, grn_obj *table);
55
56 #define GRN_TABLE_LOCK_BEGIN(ctx, table) \
57 do { \
58 grn_io *io_ = grn_obj_get_io(ctx, table); \
59 bool locked_ = false; \
60 bool can_run_ = true; \
61 if (io_ && !(io_->flags & GRN_IO_TEMPORARY)) { \
62 if (grn_io_lock(ctx, io_, grn_lock_timeout) == GRN_SUCCESS) { \
63 locked_ = true; \
64 } else { \
65 can_run_ = false; \
66 } \
67 } \
68 if (can_run_) {
69 #define GRN_TABLE_LOCK_END(ctx) \
70 } \
71 if (locked_) { \
72 grn_io_unlock(ctx, io_); \
73 } \
74 } \
75 while (false)
76
77 #ifdef __cplusplus
78 }
79 #endif