File: grn_table.h

package info (click to toggle)
groonga 15.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 163,080 kB
  • sloc: ansic: 770,564; cpp: 48,925; ruby: 40,447; javascript: 10,250; yacc: 7,045; sh: 5,602; python: 2,821; makefile: 1,672
file content (79 lines) | stat: -rw-r--r-- 3,520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
  Copyright (C) 2018  Brazil
  Copyright (C) 2019-2024  Sutou Kouhei <kou@clear-code.com>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#pragma once

#include "grn.h"

#ifdef __cplusplus
extern "C" {
#endif

double
grn_table_get_score(grn_ctx *ctx, grn_obj *table, grn_id id);

grn_obj *
grn_table_create_with_max_n_subrecs(grn_ctx *ctx,
                                    const char *name,
                                    unsigned int name_size,
                                    const char *path,
                                    grn_table_flags flags,
                                    grn_obj *key_type,
                                    grn_obj *value_type,
                                    uint32_t max_n_subrecs,
                                    uint32_t additional_value_size);

grn_rc
grn_table_setoperation_with_weight_factor(grn_ctx *ctx,
                                          grn_obj *table1,
                                          grn_obj *table2,
                                          grn_obj *res,
                                          grn_operator op,
                                          float weight_factor);

grn_id
grn_table_find_reference_object_raw(grn_ctx *ctx, grn_id table_id);

grn_hash *
grn_table_all_columns(grn_ctx *ctx, grn_obj *table);

#define GRN_TABLE_LOCK_BEGIN(ctx, table)                                       \
  do {                                                                         \
    grn_io *io_ = grn_obj_get_io(ctx, table);                                  \
    bool locked_ = false;                                                      \
    bool can_run_ = true;                                                      \
    if (io_ && !(io_->flags & GRN_IO_TEMPORARY)) {                             \
      if (grn_io_lock(ctx, io_, grn_lock_timeout) == GRN_SUCCESS) {            \
        locked_ = true;                                                        \
      } else {                                                                 \
        can_run_ = false;                                                      \
      }                                                                        \
    }                                                                          \
    if (can_run_) {
#define GRN_TABLE_LOCK_END(ctx)                                                \
  }                                                                            \
  if (locked_) {                                                               \
    grn_io_unlock(ctx, io_);                                                   \
  }                                                                            \
  }                                                                            \
  while (false)

#ifdef __cplusplus
}
#endif