rroonga 10.0.1 → 11.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/Rakefile +30 -28
- data/doc/text/news.md +51 -5
- data/doc/text/tutorial.md +1 -1
- data/ext/groonga/extconf.rb +18 -3
- data/ext/groonga/rb-grn-accessor.c +2 -2
- data/ext/groonga/rb-grn-column-cache.c +3 -3
- data/ext/groonga/rb-grn-column.c +4 -4
- data/ext/groonga/rb-grn-context.c +82 -58
- data/ext/groonga/rb-grn-data-column.c +4 -4
- data/ext/groonga/rb-grn-database.c +45 -26
- data/ext/groonga/rb-grn-double-array-trie.c +2 -2
- data/ext/groonga/rb-grn-encoding-support.c +2 -2
- data/ext/groonga/rb-grn-exception.c +14 -0
- data/ext/groonga/rb-grn-expression-builder.c +3 -3
- data/ext/groonga/rb-grn-expression.c +3 -3
- data/ext/groonga/rb-grn-fix-size-column.c +2 -2
- data/ext/groonga/rb-grn-flushable.c +2 -1
- data/ext/groonga/rb-grn-hash.c +2 -2
- data/ext/groonga/rb-grn-index-column.c +3 -3
- data/ext/groonga/rb-grn-index-cursor.c +2 -2
- data/ext/groonga/rb-grn-inverted-index-cursor.c +3 -3
- data/ext/groonga/rb-grn-object.c +30 -9
- data/ext/groonga/rb-grn-operator.c +100 -259
- data/ext/groonga/rb-grn-patricia-trie.c +2 -2
- data/ext/groonga/rb-grn-plugin.c +34 -22
- data/ext/groonga/rb-grn-request-timer-id.c +2 -2
- data/ext/groonga/rb-grn-snippet.c +3 -3
- data/ext/groonga/rb-grn-table-cursor-key-support.c +2 -2
- data/ext/groonga/rb-grn-table-cursor.c +3 -3
- data/ext/groonga/rb-grn-table-key-support.c +6 -4
- data/ext/groonga/rb-grn-table.c +63 -45
- data/ext/groonga/rb-grn-type.c +5 -1
- data/ext/groonga/rb-grn-utils.c +17 -1
- data/ext/groonga/rb-grn-variable-size-column.c +2 -2
- data/ext/groonga/rb-grn-variable.c +2 -2
- data/ext/groonga/rb-grn.h +10 -5
- data/ext/groonga/rb-groonga.c +6 -2
- data/lib/groonga/context.rb +32 -0
- data/rroonga-build.rb +5 -4
- data/rroonga.gemspec +5 -2
- data/test/groonga-test-utils.rb +9 -0
- data/test/run-test.rb +1 -1
- data/test/test-column.rb +12 -1
- data/test/test-index-column.rb +3 -3
- data/test/test-logger.rb +2 -0
- data/test/test-ractor.rb +65 -0
- data/test/test-remote.rb +16 -0
- data/test/test-table-arrow.rb +20 -11
- metadata +84 -68
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
@@ -17,12 +17,6 @@
|
|
17
17
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
*/
|
19
19
|
|
20
|
-
#include "rb-grn.h"
|
21
|
-
|
22
|
-
#define SELF(object) ((RbGrnObject *)DATA_PTR(object))
|
23
|
-
|
24
|
-
VALUE rb_cGrnDatabase;
|
25
|
-
|
26
20
|
/*
|
27
21
|
* Document-class: Groonga::Database
|
28
22
|
*
|
@@ -34,22 +28,11 @@ VALUE rb_cGrnDatabase;
|
|
34
28
|
* に作成されないので明示的に作成する必要がある。
|
35
29
|
*/
|
36
30
|
|
37
|
-
|
38
|
-
rb_grn_database_from_ruby_object (VALUE object)
|
39
|
-
{
|
40
|
-
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnDatabase))) {
|
41
|
-
rb_raise(rb_eTypeError, "not a groonga database");
|
42
|
-
}
|
31
|
+
#include "rb-grn.h"
|
43
32
|
|
44
|
-
|
45
|
-
}
|
33
|
+
#define SELF(object) ((RbGrnObject *)RTYPEDDATA_DATA(object))
|
46
34
|
|
47
|
-
VALUE
|
48
|
-
rb_grn_database_to_ruby_object (grn_ctx *context, grn_obj *database,
|
49
|
-
grn_bool owner)
|
50
|
-
{
|
51
|
-
return GRNOBJECT2RVAL(rb_cGrnDatabase, context, database, owner);
|
52
|
-
}
|
35
|
+
VALUE rb_cGrnDatabase;
|
53
36
|
|
54
37
|
static void
|
55
38
|
rb_grn_database_mark_existing_ruby_object (grn_ctx *context, grn_obj *database)
|
@@ -86,11 +69,45 @@ rb_grn_database_mark (void *data)
|
|
86
69
|
rb_grn_database_mark_existing_ruby_object(context, database);
|
87
70
|
}
|
88
71
|
|
72
|
+
static void
|
73
|
+
rb_grn_database_free (void *pointer)
|
74
|
+
{
|
75
|
+
rb_grn_object_free(pointer);
|
76
|
+
}
|
77
|
+
|
78
|
+
static rb_data_type_t data_type = {
|
79
|
+
"Groonga::Database",
|
80
|
+
{
|
81
|
+
rb_grn_database_mark,
|
82
|
+
rb_grn_database_free,
|
83
|
+
NULL,
|
84
|
+
},
|
85
|
+
&rb_grn_object_data_type,
|
86
|
+
NULL,
|
87
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
88
|
+
};
|
89
|
+
|
90
|
+
grn_obj *
|
91
|
+
rb_grn_database_from_ruby_object (VALUE object)
|
92
|
+
{
|
93
|
+
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnDatabase))) {
|
94
|
+
rb_raise(rb_eTypeError, "not a Rroonga database");
|
95
|
+
}
|
96
|
+
|
97
|
+
return RVAL2GRNOBJECT(object, NULL);
|
98
|
+
}
|
99
|
+
|
100
|
+
VALUE
|
101
|
+
rb_grn_database_to_ruby_object (grn_ctx *context, grn_obj *database,
|
102
|
+
grn_bool owner)
|
103
|
+
{
|
104
|
+
return GRNOBJECT2RVAL(rb_cGrnDatabase, context, database, owner);
|
105
|
+
}
|
106
|
+
|
89
107
|
static VALUE
|
90
108
|
rb_grn_database_alloc (VALUE klass)
|
91
109
|
{
|
92
|
-
return
|
93
|
-
NULL);
|
110
|
+
return TypedData_Wrap_Struct(klass, &data_type, NULL);
|
94
111
|
}
|
95
112
|
|
96
113
|
static void
|
@@ -143,8 +160,7 @@ rb_grn_database_close (VALUE self)
|
|
143
160
|
static void
|
144
161
|
reset_floating_objects (VALUE rb_context)
|
145
162
|
{
|
146
|
-
RbGrnContext *rb_grn_context;
|
147
|
-
Data_Get_Struct(rb_context, RbGrnContext, rb_grn_context);
|
163
|
+
RbGrnContext *rb_grn_context = rb_grn_context_get_struct(rb_context);
|
148
164
|
rb_grn_context_reset_floating_objects(rb_grn_context);
|
149
165
|
}
|
150
166
|
|
@@ -189,8 +205,10 @@ rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass)
|
|
189
205
|
"builtin_type_names", &builtin_type_names,
|
190
206
|
NULL);
|
191
207
|
|
192
|
-
if (!NIL_P(rb_path))
|
208
|
+
if (!NIL_P(rb_path)) {
|
209
|
+
FilePathValue(rb_path);
|
193
210
|
path = StringValuePtr(rb_path);
|
211
|
+
}
|
194
212
|
context = rb_grn_context_ensure(&rb_context);
|
195
213
|
|
196
214
|
create_args.builtin_type_names = NULL;
|
@@ -245,6 +263,7 @@ rb_grn_database_initialize (int argc, VALUE *argv, VALUE self)
|
|
245
263
|
|
246
264
|
rb_scan_args(argc, argv, "11", &rb_path, &options);
|
247
265
|
|
266
|
+
FilePathValue(rb_path);
|
248
267
|
path = StringValuePtr(rb_path);
|
249
268
|
rb_grn_scan_options(options,
|
250
269
|
"context", &rb_context,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/* vim: set sts=4 sw=4 ts=8 noet: */
|
3
3
|
/*
|
4
|
+
Copyright (C) 2011-2021 Sutou Kouhei <kou@clear-code.com>
|
4
5
|
Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
|
5
|
-
Copyright (C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
|
6
6
|
|
7
7
|
This library is free software; you can redistribute it and/or
|
8
8
|
modify it under the terms of the GNU Lesser General Public
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
#include "rb-grn.h"
|
22
22
|
|
23
|
-
#define SELF(object) ((RbGrnDoubleArrayTrie *)
|
23
|
+
#define SELF(object) ((RbGrnDoubleArrayTrie *)RTYPEDDATA_DATA(object))
|
24
24
|
|
25
25
|
VALUE rb_cGrnDoubleArrayTrie;
|
26
26
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
20
20
|
|
21
|
-
#define SELF(object) (RB_GRN_OBJECT(
|
21
|
+
#define SELF(object) (RB_GRN_OBJECT(RTYPEDDATA_DATA(object)))
|
22
22
|
|
23
23
|
VALUE rb_mGrnEncodingSupport;
|
24
24
|
|
@@ -103,6 +103,7 @@ static VALUE eGrnScorerError;
|
|
103
103
|
static VALUE eGrnCancel;
|
104
104
|
static VALUE eGrnWindowFunctionError;
|
105
105
|
static VALUE eGrnZstdError;
|
106
|
+
static VALUE eGrnConnectionReset;
|
106
107
|
|
107
108
|
VALUE
|
108
109
|
rb_grn_rc_to_exception (grn_rc rc)
|
@@ -353,6 +354,9 @@ rb_grn_rc_to_exception (grn_rc rc)
|
|
353
354
|
case GRN_ZSTD_ERROR:
|
354
355
|
exception = eGrnZstdError;
|
355
356
|
break;
|
357
|
+
case GRN_CONNECTION_RESET:
|
358
|
+
exception = eGrnConnectionReset;
|
359
|
+
break;
|
356
360
|
}
|
357
361
|
|
358
362
|
if (NIL_P(exception))
|
@@ -1072,4 +1076,14 @@ rb_grn_init_exception (VALUE mGrn)
|
|
1072
1076
|
*/
|
1073
1077
|
eGrnZstdError =
|
1074
1078
|
rb_define_class_under(mGrn, "ZstdError", rb_eGrnError);
|
1079
|
+
|
1080
|
+
/*
|
1081
|
+
* Document-class: Groonga::ConnectionReset
|
1082
|
+
*
|
1083
|
+
* It is used when connection is reset.
|
1084
|
+
*
|
1085
|
+
* @since 10.1.1
|
1086
|
+
*/
|
1087
|
+
eGrnConnectionReset =
|
1088
|
+
rb_define_class_under(mGrn, "ConnectionReset", rb_eGrnError);
|
1075
1089
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009 Kouhei
|
3
|
+
Copyright (C) 2009-2020 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -42,9 +42,9 @@ build (VALUE self)
|
|
42
42
|
}
|
43
43
|
|
44
44
|
static VALUE
|
45
|
-
build_block (
|
45
|
+
build_block (RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
|
46
46
|
{
|
47
|
-
return rb_funcall(rb_block_proc(), rb_intern("call"), 1,
|
47
|
+
return rb_funcall(rb_block_proc(), rb_intern("call"), 1, yielded_arg);
|
48
48
|
}
|
49
49
|
|
50
50
|
VALUE
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
#include "rb-grn.h"
|
21
21
|
|
22
|
-
#define SELF(object) ((RbGrnExpression *)
|
22
|
+
#define SELF(object) ((RbGrnExpression *)RTYPEDDATA_DATA(object))
|
23
23
|
|
24
24
|
VALUE rb_cGrnExpression;
|
25
25
|
|
@@ -100,7 +100,7 @@ rb_grn_expression_initialize (int argc, VALUE *argv, VALUE self)
|
|
100
100
|
expression = grn_expr_create(context, name, name_size);
|
101
101
|
rb_grn_context_check(context, self);
|
102
102
|
rb_grn_object_assign(Qnil, self, rb_context, context, expression);
|
103
|
-
rb_grn_context_register_floating_object(
|
103
|
+
rb_grn_context_register_floating_object(RTYPEDDATA_DATA(self));
|
104
104
|
|
105
105
|
rb_iv_set(self, "@objects", rb_ary_new());
|
106
106
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
|
6
6
|
This library is free software; you can redistribute it and/or
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
#include "rb-grn.h"
|
21
21
|
|
22
|
-
#define SELF(object) ((RbGrnColumn *)
|
22
|
+
#define SELF(object) ((RbGrnColumn *)RTYPEDDATA_DATA(object))
|
23
23
|
|
24
24
|
VALUE rb_cGrnFixSizeColumn;
|
25
25
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2015 Masafumi Yokoyama <yokoyama@clear-code.com>
|
4
|
+
Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
|
4
5
|
|
5
6
|
This library is free software; you can redistribute it and/or
|
6
7
|
modify it under the terms of the GNU Lesser General Public
|
@@ -18,7 +19,7 @@
|
|
18
19
|
|
19
20
|
#include "rb-grn.h"
|
20
21
|
|
21
|
-
#define SELF(object) (RB_GRN_OBJECT(
|
22
|
+
#define SELF(object) (RB_GRN_OBJECT(RTYPEDDATA_DATA(object)))
|
22
23
|
|
23
24
|
VALUE rb_mGrnFlushable;
|
24
25
|
|
data/ext/groonga/rb-grn-hash.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
20
20
|
|
21
|
-
#define SELF(object) ((RbGrnTableKeySupport *)
|
21
|
+
#define SELF(object) ((RbGrnTableKeySupport *)RTYPEDDATA_DATA(object))
|
22
22
|
|
23
23
|
VALUE rb_cGrnHash;
|
24
24
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C)
|
4
|
-
Copyright (C) 2009-2017 Kouhei Sutou <kou@clear-code.com>
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
5
4
|
Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
|
+
Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
6
6
|
|
7
7
|
This library is free software; you can redistribute it and/or
|
8
8
|
modify it under the terms of the GNU Lesser General Public
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
-
#define SELF(object) ((RbGrnIndexColumn *)
|
25
|
+
#define SELF(object) ((RbGrnIndexColumn *)RTYPEDDATA_DATA(object))
|
26
26
|
|
27
27
|
VALUE rb_cGrnIndexColumn;
|
28
28
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
3
|
Copyright (C) 2011 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
|
-
Copyright (C) 2012 Kouhei
|
4
|
+
Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
|
5
5
|
Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
6
6
|
|
7
7
|
This library is free software; you can redistribute it and/or
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
#include "rb-grn.h"
|
22
22
|
|
23
|
-
#define SELF(object) ((RbGrnIndexCursor *)
|
23
|
+
#define SELF(object) ((RbGrnIndexCursor *)RTYPEDDATA_DATA(object))
|
24
24
|
|
25
25
|
VALUE rb_cGrnIndexCursor;
|
26
26
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2017 Kouhei
|
3
|
+
Copyright (C) 2017-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
|
5
5
|
This library is free software; you can redistribute it and/or
|
6
6
|
modify it under the terms of the GNU Lesser General Public
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
#include "rb-grn.h"
|
20
20
|
|
21
|
-
#define SELF(object) ((RbGrnInvertedIndexCursor *)
|
21
|
+
#define SELF(object) ((RbGrnInvertedIndexCursor *)RTYPEDDATA_DATA(object))
|
22
22
|
|
23
23
|
typedef struct _RbGrnInvertedIndexCursor RbGrnInvertedIndexCursor;
|
24
24
|
struct _RbGrnInvertedIndexCursor
|
@@ -255,7 +255,7 @@ void
|
|
255
255
|
rb_grn_init_inverted_index_cursor (VALUE mGrn)
|
256
256
|
{
|
257
257
|
rb_cGrnInvertedIndexCursor =
|
258
|
-
rb_define_class_under(mGrn, "InvertedIndexCursor",
|
258
|
+
rb_define_class_under(mGrn, "InvertedIndexCursor", rb_cObject);
|
259
259
|
rb_include_module(rb_cGrnInvertedIndexCursor, rb_mEnumerable);
|
260
260
|
|
261
261
|
rb_define_method(rb_cGrnInvertedIndexCursor, "next",
|
data/ext/groonga/rb-grn-object.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2
2
|
/*
|
3
|
-
Copyright (C) 2009-
|
3
|
+
Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
|
4
4
|
Copyright (C) 2014-2016 Masafumi Yokoyama <yokoyama@clear-code.com>
|
5
5
|
Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
|
6
6
|
|
@@ -28,10 +28,28 @@
|
|
28
28
|
|
29
29
|
#include "rb-grn.h"
|
30
30
|
|
31
|
-
#define SELF(object) ((RbGrnObject *)
|
31
|
+
#define SELF(object) ((RbGrnObject *)RTYPEDDATA_DATA(object))
|
32
32
|
|
33
33
|
VALUE rb_cGrnObject;
|
34
34
|
|
35
|
+
static void
|
36
|
+
rb_grn_object_dfree (void *pointer)
|
37
|
+
{
|
38
|
+
rb_grn_object_free(pointer);
|
39
|
+
}
|
40
|
+
|
41
|
+
rb_data_type_t rb_grn_object_data_type = {
|
42
|
+
"Groonga::Object",
|
43
|
+
{
|
44
|
+
NULL,
|
45
|
+
rb_grn_object_dfree,
|
46
|
+
NULL,
|
47
|
+
},
|
48
|
+
NULL,
|
49
|
+
NULL,
|
50
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
51
|
+
};
|
52
|
+
|
35
53
|
grn_obj *
|
36
54
|
rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
|
37
55
|
{
|
@@ -73,7 +91,10 @@ rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
|
|
73
91
|
rb_grn_inspect(object));
|
74
92
|
}
|
75
93
|
|
76
|
-
|
94
|
+
TypedData_Get_Struct(object,
|
95
|
+
RbGrnObject,
|
96
|
+
&rb_grn_object_data_type,
|
97
|
+
rb_grn_object);
|
77
98
|
if (!rb_grn_object)
|
78
99
|
rb_raise(rb_eGrnError, "Groonga object is NULL");
|
79
100
|
|
@@ -350,7 +371,9 @@ rb_grn_object_to_ruby_object (VALUE klass, grn_ctx *context, grn_obj *object,
|
|
350
371
|
VALUE
|
351
372
|
rb_grn_object_alloc (VALUE klass)
|
352
373
|
{
|
353
|
-
return
|
374
|
+
return TypedData_Wrap_Struct(klass,
|
375
|
+
&rb_grn_object_data_type,
|
376
|
+
NULL);
|
354
377
|
}
|
355
378
|
|
356
379
|
static void
|
@@ -359,15 +382,13 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context,
|
|
359
382
|
grn_ctx *context, grn_obj *object)
|
360
383
|
{
|
361
384
|
grn_user_data *user_data;
|
362
|
-
RbGrnContext *rb_grn_context;
|
363
385
|
|
364
386
|
debug("bind: %p:%p:%p %s(%#x)\n",
|
365
387
|
context, object, rb_grn_object,
|
366
388
|
grn_obj_type_to_string(object->header.type),
|
367
389
|
object->header.type);
|
368
390
|
|
369
|
-
|
370
|
-
rb_grn_object->rb_grn_context = rb_grn_context;
|
391
|
+
rb_grn_object->rb_grn_context = rb_grn_context_get_struct(rb_context);
|
371
392
|
rb_grn_object->context = context;
|
372
393
|
rb_grn_object->object = object;
|
373
394
|
rb_grn_object->self = self;
|
@@ -419,7 +440,7 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context,
|
|
419
440
|
else
|
420
441
|
rb_grn_object->range = grn_ctx_at(context, rb_grn_object->range_id);
|
421
442
|
|
422
|
-
|
443
|
+
RTYPEDDATA_DATA(self) = rb_grn_object;
|
423
444
|
}
|
424
445
|
|
425
446
|
void
|
@@ -2213,7 +2234,7 @@ rb_grn_object_get_disk_usage (VALUE self)
|
|
2213
2234
|
void
|
2214
2235
|
rb_grn_init_object (VALUE mGrn)
|
2215
2236
|
{
|
2216
|
-
rb_cGrnObject = rb_define_class_under(mGrn, "Object",
|
2237
|
+
rb_cGrnObject = rb_define_class_under(mGrn, "Object", rb_cObject);
|
2217
2238
|
rb_define_alloc_func(rb_cGrnObject, rb_grn_object_alloc);
|
2218
2239
|
|
2219
2240
|
rb_define_attr(rb_cGrnObject, "context", GRN_TRUE, GRN_FALSE);
|