rroonga 7.0.2 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1349d0af1d5185ee0bdd44af2b212dcf55a28e7a
4
- data.tar.gz: cfa39b3cf8128946bb1d22d9ee39bc8c39c0860c
3
+ metadata.gz: f0ff170aa9082bbfb76dec6278fdf8e73e63d27b
4
+ data.tar.gz: 036da819743397109b89e4bf03c08083bf006cdc
5
5
  SHA512:
6
- metadata.gz: b4a58abe995dd332f77d4e6e36ad837469e6a9653bb3be44ed2fe297c3cfdf5c061f7a76b90de2b045454e79215ac913eb32a9d29718bbafb38dfad65bc44fd8
7
- data.tar.gz: 1a89ed23b0b257a227998309d9297ccfd10fe5f14feb7d77974ce21ea9d0e34d530c6ffbf35e4fb8ff21236b1f43f7dec7dbce76c1f7f3b9c62c403306ffb875
6
+ metadata.gz: 1803d21a06243393ec418481e630b190d1b28cbb027fa10d9204967a4af8502ae9cb30ed25ce4acf578fbe62f924cc3fed8be2d6394b6b2e279808f41491c4a0
7
+ data.tar.gz: 286a503c57d6c6a82f625fcb893f03bba784020b465b335115c24b28474ea99612868ff4b827f108cb77c23118677a785b4762d31ee40fb98f8ff8cfade16999
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8; mode: ruby -*-
2
2
  #
3
- # Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
4
4
  # Copyright (C) 2017 Masafumi Yokoyama <yokoyama@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
@@ -158,7 +158,7 @@ windows_architectures = [:x86, :x64]
158
158
 
159
159
  namespace :build do
160
160
  namespace :windows do
161
- ruby_versions = "2.1.6:2.2.2:2.3.0:2.4.0"
161
+ ruby_versions = "2.1.6:2.2.2:2.3.0:2.4.0:2.5.0"
162
162
 
163
163
  windows_architectures.each do |architecture|
164
164
  desc "Build gem for Windows #{architecture}"
@@ -1,5 +1,44 @@
1
1
  # NEWS
2
2
 
3
+ ## 7.1.1: 2018-01-30 {#version-7-1-1}
4
+
5
+ ### Improvements
6
+
7
+ * Added Groonga 7.1.1 support. Groonga 7.1.0 or older aren't supported.
8
+
9
+ * Added Apache Arrow support:
10
+
11
+ * {Groonga::Table#load_arrow}
12
+
13
+ * {Groonga::Table#dump_arrow}
14
+
15
+ * Windows: Added Ruby 2.4 or later support.
16
+ [groonga-dev,04565][Reported by ongaeshi]
17
+
18
+ * {Groonga::ColumnCache}: Added.
19
+
20
+ * {Groonga::Expression#parse}: Added `:no_syntax_error` option.
21
+
22
+ * {Groonga::Context#support_arrow?}: Added.
23
+
24
+ * {Groonga::Procedure#stable?}: Added.
25
+
26
+ * {Groonga::Array}: Removed queue support.
27
+
28
+ * {Groonga::QueryLogger.flags}: Added.
29
+
30
+ * {Groonga::QueryLogger.flags=}: Added.
31
+
32
+ * {Groonga::Object#corrupt?}: Added.
33
+
34
+ * {Groonga::Object#disk_usage}: Added.
35
+
36
+ ### Thanks
37
+
38
+ * naofumi-fujii
39
+
40
+ * ongaeshi
41
+
3
42
  ## 7.0.2: 2017-04-29 {#version-7-0-2}
4
43
 
5
44
  ### Improvements
@@ -13,10 +52,10 @@
13
52
 
14
53
  * {Groonga::InvertedIndexCursor#closed?}: Added.
15
54
 
16
- * {Groonga::TableKeySupport#key?}: Added.
55
+ * {Groonga::Table::KeySupport#key?}: Added.
17
56
 
18
- * {Groonga::TableKeySupport#has_key?}: Deprecated. Use
19
- {Groonga::TableKeySupport#key?} instead.
57
+ * {Groonga::Table::KeySupport#has_key?}: Deprecated. Use
58
+ {Groonga::Table::KeySupport#key?} instead.
20
59
 
21
60
  * {Groonga::DataColumn#apply_window_function}: Supported `:group_keys`.
22
61
 
@@ -252,7 +291,7 @@
252
291
  * Added {Groonga::Object#accessor?}.
253
292
  * Added {Groonga::Object#key_accessor?}.
254
293
  * Added {Groonga::Database#reindex}.
255
- * Added {Groonga::TableKeySupport#reindex}.
294
+ * Added {Groonga::Table::KeySupport#reindex}.
256
295
  * Added {Groonga::FixSizeColumn#reindex}.
257
296
  * Added {Groonga::VariableSizeColumn#reindex}.
258
297
  * Added {Groonga::IndexColumn#reindex}.
@@ -1435,7 +1474,7 @@
1435
1474
 
1436
1475
  * Used :key as the default value of `:order_by` of
1437
1476
  `Groonga::PatriciaTrie#open_cursor`.
1438
- * Removed a deprecated Groonga::TableKeySupport#find.
1477
+ * Removed a deprecated Groonga::Table::KeySupport#find.
1439
1478
  * Used ShortText as the default key type of
1440
1479
  Groonga::Hash#create and Groonga::PatriciaTrie#create.
1441
1480
  * Renamed Groonga::Schema#load to Groonga::Schema#restore.
@@ -1562,7 +1601,7 @@
1562
1601
  * Groonga::Table#find -> Groonga::Table#[]
1563
1602
  * Groonga::Table#find -> obsolete
1564
1603
  * Groonga::Table#[]= -> removed
1565
- * Groonga::TableKeySupport#[]= is alias of Groonga::TableKeySupport#add
1604
+ * Groonga::Table::KeySupport#[]= is alias of Groonga::Table::KeySupport#add
1566
1605
  * Changed exception class to Groonga::NoSuchColumn from
1567
1606
  Groonga::InvalidArgument when Groonga::Record accesses nonexistent
1568
1607
  a column.
@@ -1604,7 +1643,7 @@
1604
1643
 
1605
1644
  ## 0.0.3: 2009-07-18
1606
1645
 
1607
- * Added Groonga::TableKeySupport#has_key? [#26145] [Tasuku SUENAGA]
1646
+ * Added Groonga::Table::KeySupport#has_key? [#26145] [Tasuku SUENAGA]
1608
1647
  * Groonga::Record#[] raises an exception for nonexistent
1609
1648
  column name. [#26146] [Tasuku SUENAGA]
1610
1649
  * Supported 32bit environment [niku]
@@ -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-2013 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2018 Kouhei Sutou <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
@@ -192,274 +192,6 @@ rb_grn_array_add (int argc, VALUE *argv, VALUE self)
192
192
  }
193
193
  }
194
194
 
195
- typedef struct _YieldRecordCallbackData
196
- {
197
- VALUE self;
198
- VALUE record;
199
- grn_id id;
200
- int status;
201
- } YieldRecordCallbackData;
202
-
203
- static VALUE
204
- yield_record (VALUE user_data)
205
- {
206
- YieldRecordCallbackData *data = (YieldRecordCallbackData *)user_data;
207
- volatile VALUE record;
208
-
209
- if (data->id == GRN_ID_NIL) {
210
- record = Qnil;
211
- } else {
212
- record = rb_grn_record_new(data->self, data->id, Qnil);
213
- }
214
- data->record = record;
215
-
216
- return rb_yield(record);
217
- }
218
-
219
- static void
220
- yield_record_callback (grn_ctx *ctx, grn_array *array,
221
- grn_id id, void *user_data)
222
- {
223
- YieldRecordCallbackData *data = user_data;
224
-
225
- data->id = id;
226
- rb_protect(yield_record, (VALUE)(data), &(data->status));
227
- }
228
-
229
- /*
230
- * Pushes a record to the array. The record should be filled in the
231
- * given block. The pushed record can be pulled by
232
- * {Groonga::Array#pull}.
233
- *
234
- * @example A program that pushes a job without error handling
235
- * queue = Groonga::Array.create(:name => "CrawlURLQueue")
236
- * queue.define_column("url", "ShortText")
237
- * urls = ["http://groonga.org/", "http://ranguba.org/"]
238
- * urls.each do |url|
239
- * queue.push do |record|
240
- * record.url = url
241
- * end
242
- * end
243
- *
244
- * @example A program that pulls a job without error handling
245
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
246
- * loop do
247
- * url = nil
248
- * queue.pull do |record|
249
- * url = record.url
250
- * record.delete
251
- * end
252
- * # Crawl URL
253
- * end
254
- *
255
- * The record that is passed to the given block may be nil. You need
256
- * to handle the case. For example, just ignoring it or reports an
257
- * error.
258
- *
259
- * @example A program that pushes a job with error handling
260
- * queue = Groonga::Array.create(:name => "CrawlURLQueue")
261
- * queue.define_column("url", "ShortText")
262
- * urls = ["http://groonga.org/", "http://ranguba.org/"]
263
- * urls.each do |url|
264
- * queue.push do |record|
265
- * record.url = url if record # check record is not nil
266
- * end
267
- * end
268
- *
269
- * If an error is occurred in the given block, the pushed record may
270
- * not be filled completely. You should handle the case in pull side.
271
- *
272
- * @example A program that has an error in push block
273
- * queue = Groonga::Array.create(:name => "CrawlURLQueue")
274
- * queue.define_column("url", "ShortText")
275
- * urls = ["http://groonga.org/", "http://ranguba.org/"]
276
- * urls.each do |url|
277
- * queue.push do |record|
278
- * record.url = uri # Typo! It should be ur*l* not ur*i*
279
- * # record.url isn't set
280
- * end
281
- * end
282
- *
283
- * @example A program that pulls a job with error handling
284
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
285
- * loop do
286
- * url = nil
287
- * queue.pull do |record|
288
- * url = record.url # record.url is nil!
289
- * record.delete
290
- * end
291
- * next if url.nil? # Ignore an uncompleted added job
292
- * # Crawl URL
293
- * end
294
- *
295
- * @overload push
296
- * @yield [record] Filles columns of a pushed record in the given block.
297
- * @yieldparam record [Groonga::Record or nil]
298
- * A pushed record. It is nil when pushing is failed.
299
- * @return [Groonga::Record or nil] A pushed record that is yielded.
300
- *
301
- */
302
- static VALUE
303
- rb_grn_array_push (VALUE self)
304
- {
305
- grn_ctx *context = NULL;
306
- grn_obj *table;
307
- YieldRecordCallbackData data;
308
-
309
- if (!rb_block_given_p()) {
310
- rb_raise(rb_eArgError,
311
- "tried to call Groonga::Array#push without a block");
312
- }
313
-
314
- table = SELF(self, &context);
315
-
316
- data.self = self;
317
- data.record = Qnil;
318
- data.status = 0;
319
- grn_array_push(context, (grn_array *)table, yield_record_callback, &data);
320
- if (data.status != 0) {
321
- rb_jump_tag(data.status);
322
- }
323
- rb_grn_context_check(context, self);
324
-
325
- return data.record;
326
- }
327
-
328
- /*
329
- * Pulls a record from the array. The required values should be
330
- * retrieved in the given block.
331
- *
332
- * If {Groonga::Array#push} failes to fill values of the pushed
333
- * record, the pulled record may be uncompleted. It should be handled
334
- * by your application.
335
- *
336
- * If you passes @:block? => true@ option, the pull operation blocks
337
- * until a pushed record is pushed. It is the default behavior.
338
- *
339
- * If you passes @:block? => false@ option, the pull operation returns
340
- * immediately, the given block isn't called and returns nil when no
341
- * record exist in the array.
342
- *
343
- * @example A program that pulls with non-block mode
344
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
345
- * loop do
346
- * url = nil
347
- * # The case for no pushed records in the array.
348
- * pulled_record = queue.pull(:block? => false) do |record|
349
- * # This block isn't called
350
- * url = record.url
351
- * record.delete
352
- * end
353
- * p pulled_record.nil? # => true
354
- * end
355
- *
356
- * Note that your signal handlers can't be ran while a pull
357
- * operation. You need to use {Groonga::Array#unblock} from
358
- * another process to unblock the pull operation. If you call
359
- * {Groonga::Array#unblock}, signal handler can be ran.
360
- *
361
- * @example Signal handler isn't called
362
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
363
- * trap(:INT) do
364
- * p :not_called!
365
- * end
366
- * queue.pull do |record|
367
- * # Send SIGINT while blocking the pull operation.
368
- * # The signal handler isn't called.
369
- * end
370
- *
371
- * @see Groonga::Array#push Examples exist in the push documentation.
372
- *
373
- * @overload pull(options={})
374
- * @param [::Hash] options The option parameters.
375
- * @option options [Boolean] :block? (true)
376
- * Whether the pull operation is blocked or not when no record exist
377
- * in the array.
378
- * @yield [record] Gets required values for a pull record in the given block.
379
- * @yieldparam record [Groonga::Record or nil]
380
- * A pulled record. It is nil when no records exist in the array
381
- * and @block?@ parameter is not @true@.
382
- * @return [Groonga::Record or nil] A pulled record that is yielded.
383
- *
384
- */
385
- static VALUE
386
- rb_grn_array_pull (int argc, VALUE *argv, VALUE self)
387
- {
388
- grn_ctx *context = NULL;
389
- grn_obj *table;
390
- VALUE options;
391
- VALUE rb_block_p;
392
- YieldRecordCallbackData data;
393
-
394
- rb_scan_args(argc, argv, "01", &options);
395
-
396
- rb_grn_scan_options(options,
397
- "block?", &rb_block_p,
398
- NULL);
399
-
400
- if (!rb_block_given_p()) {
401
- rb_raise(rb_eArgError,
402
- "tried to call Groonga::Array#pull without a block");
403
- }
404
-
405
- table = SELF(self, &context);
406
-
407
- if (NIL_P(rb_block_p)) {
408
- rb_block_p = Qtrue;
409
- }
410
-
411
- data.self = self;
412
- data.record = Qnil;
413
- data.status = 0;
414
- grn_array_pull(context, (grn_array *)table, RVAL2CBOOL(rb_block_p),
415
- yield_record_callback, &data);
416
- if (data.status != 0) {
417
- rb_jump_tag(data.status);
418
- }
419
- rb_grn_context_check(context, self);
420
-
421
- return data.record;
422
- }
423
-
424
- /*
425
- * Unblocks all {Groonga::Array#pull} operations for the array.
426
- *
427
- * @example Pull, unblock and signal
428
- * # pull.rb
429
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
430
- * trap(:INT) do
431
- * p :called!
432
- * end
433
- * queue.pull do |record|
434
- * # 1. Send SIGINT while blocking the pull operation.
435
- * # The signal handler isn't called.
436
- * # 2. Run unblock.rb.
437
- * # The signal handler is called!
438
- * end
439
- *
440
- * # unblock.rb
441
- * queue = Groonga::Array.open(:name => "CrawlURLQueue")
442
- * queue.unblock
443
- *
444
- * @see Groonga::Array#pull
445
- *
446
- * @overload unblock
447
- * @return [void]
448
- *
449
- */
450
- static VALUE
451
- rb_grn_array_unblock (VALUE self)
452
- {
453
- grn_ctx *context = NULL;
454
- grn_obj *table;
455
-
456
- table = SELF(self, &context);
457
-
458
- grn_array_unblock(context, (grn_array *)table);
459
-
460
- return Qnil;
461
- }
462
-
463
195
  void
464
196
  rb_grn_init_array (VALUE mGrn)
465
197
  {
@@ -469,7 +201,4 @@ rb_grn_init_array (VALUE mGrn)
469
201
  rb_grn_array_s_create, -1);
470
202
 
471
203
  rb_define_method(rb_cGrnArray, "add", rb_grn_array_add, -1);
472
- rb_define_method(rb_cGrnArray, "push", rb_grn_array_push, 0);
473
- rb_define_method(rb_cGrnArray, "pull", rb_grn_array_pull, -1);
474
- rb_define_method(rb_cGrnArray, "unblock", rb_grn_array_unblock, 0);
475
204
  }
@@ -0,0 +1,240 @@
1
+ /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
+ /* vim: set sts=4 sw=4 ts=8 noet: */
3
+ /*
4
+ Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
5
+
6
+ This library is free software; you can redistribute it and/or
7
+ modify it under the terms of the GNU Lesser General Public
8
+ License version 2.1 as published by the Free Software Foundation.
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
+ #include "rb-grn.h"
21
+
22
+ /*
23
+ * Document-class: Groonga::ColumnCache
24
+ *
25
+ * This is a class for accelerating column value read.
26
+ *
27
+ * {Groonga::FixSizeColumn} is only supported for now.
28
+ *
29
+ * @since 7.1.1
30
+ */
31
+
32
+ VALUE rb_cGrnColumnCache;
33
+
34
+ static void
35
+ rb_grn_column_cache_mark(void *data)
36
+ {
37
+ RbGrnColumnCache *rb_grn_column_cache = data;
38
+
39
+ if (!rb_grn_column_cache->column_cache)
40
+ return;
41
+
42
+ rb_gc_mark(rb_grn_column_cache->rb_column);
43
+ }
44
+
45
+ static void
46
+ rb_grn_column_cache_free(void *data)
47
+ {
48
+ RbGrnColumnCache *rb_grn_column_cache = data;
49
+
50
+ if (!rb_grn_column_cache->column_cache)
51
+ return;
52
+
53
+ GRN_OBJ_FIN(rb_grn_column_cache->context,
54
+ &(rb_grn_column_cache->buffer));
55
+ grn_column_cache_close(rb_grn_column_cache->context,
56
+ rb_grn_column_cache->column_cache);
57
+ }
58
+
59
+ static rb_data_type_t data_type = {
60
+ "Groonga::ColumnCache",
61
+ {
62
+ rb_grn_column_cache_mark,
63
+ rb_grn_column_cache_free,
64
+ NULL,
65
+ },
66
+ NULL,
67
+ NULL,
68
+ RUBY_TYPED_FREE_IMMEDIATELY
69
+ };
70
+
71
+ static VALUE
72
+ rb_grn_column_cache_allocate (VALUE klass)
73
+ {
74
+ return TypedData_Wrap_Struct(klass, &data_type, NULL);
75
+ }
76
+
77
+ static VALUE rb_grn_column_cache_close (VALUE self);
78
+
79
+ /*
80
+ * Opens a new column cache and passes to the given block. The opened
81
+ * column cache is closed after the given block is finished.
82
+ *
83
+ * @overload open(column) {|column_cache| ...}
84
+ * @param column [Groonga::Column] The column to be cached.
85
+ *
86
+ * @yieldparam [Groonga::ColumnCache] The opened column cache.
87
+ *
88
+ * @return [Object] The object returned by the given block.
89
+ */
90
+ static VALUE
91
+ rb_grn_column_cache_s_open (VALUE klass, VALUE rb_column)
92
+ {
93
+ VALUE rb_column_cache;
94
+
95
+ rb_column_cache = rb_funcall(klass, rb_intern("new"), 1, rb_column);
96
+ if (rb_block_given_p()) {
97
+ return rb_ensure(rb_yield, rb_column_cache,
98
+ rb_grn_column_cache_close, rb_column_cache);
99
+ } else {
100
+ return rb_column_cache;
101
+ }
102
+ }
103
+
104
+ /*
105
+ * @overload initialize(column)
106
+ * @param column [Groonga::Column] The column to be cached.
107
+ *
108
+ * @return [Groonga::ColumnCache] Create a new column cache.
109
+ */
110
+ static VALUE
111
+ rb_grn_column_cache_initialize (VALUE self, VALUE rb_column)
112
+ {
113
+ RbGrnColumnCache *rb_grn_column_cache;
114
+ grn_ctx *context;
115
+ grn_obj *column;
116
+ grn_id range_id;
117
+
118
+ rb_grn_column_cache = ALLOC(RbGrnColumnCache);
119
+ rb_grn_column_cache->self = self;
120
+ rb_grn_column_cache->context = NULL;
121
+ rb_grn_column_cache->rb_column = rb_column;
122
+ rb_grn_column_cache->column_cache = NULL;
123
+ DATA_PTR(self) = rb_grn_column_cache;
124
+
125
+ column = RVAL2GRNCOLUMN(rb_column, &(rb_grn_column_cache->context));
126
+ context = rb_grn_column_cache->context;
127
+ rb_grn_column_cache->column_cache = grn_column_cache_open(context, column);
128
+ if (!rb_grn_column_cache->column_cache) {
129
+ rb_raise(rb_eArgError,
130
+ "failed to create column cache: %s%s%" PRIsVALUE,
131
+ context->rc == GRN_SUCCESS ? "" : context->errbuf,
132
+ context->rc == GRN_SUCCESS ? "" : ": ",
133
+ rb_column);
134
+ }
135
+
136
+ range_id = grn_obj_get_range(context, column);
137
+ GRN_VALUE_FIX_SIZE_INIT(&(rb_grn_column_cache->buffer),
138
+ GRN_OBJ_DO_SHALLOW_COPY,
139
+ range_id);
140
+ rb_grn_column_cache->range = grn_ctx_at(context, range_id);
141
+ rb_grn_column_cache->table = grn_ctx_at(context, column->header.domain);
142
+
143
+ return Qnil;
144
+ }
145
+
146
+ /*
147
+ * @overload [](id)
148
+ * @param id [Integer, Groonga::Record] The record ID for the
149
+ * column value.
150
+ *
151
+ * @return [Object] The value for the record ID.
152
+ */
153
+ static VALUE
154
+ rb_grn_column_cache_array_reference (VALUE self, VALUE rb_id)
155
+ {
156
+ RbGrnColumnCache *rb_grn_column_cache;
157
+ grn_id id;
158
+ void *value;
159
+ size_t value_size = 0;
160
+
161
+ TypedData_Get_Struct(self,
162
+ RbGrnColumnCache,
163
+ &data_type,
164
+ rb_grn_column_cache);
165
+
166
+ if (!rb_grn_column_cache->column_cache) {
167
+ return Qnil;
168
+ }
169
+
170
+ id = rb_grn_id_from_ruby_object(rb_id,
171
+ rb_grn_column_cache->context,
172
+ rb_grn_column_cache->table,
173
+ self);
174
+ value = grn_column_cache_ref(rb_grn_column_cache->context,
175
+ rb_grn_column_cache->column_cache,
176
+ id,
177
+ &value_size);
178
+ rb_grn_context_check(rb_grn_column_cache->context, self);
179
+ GRN_TEXT_SET_REF(&(rb_grn_column_cache->buffer),
180
+ value,
181
+ value_size);
182
+
183
+ return GRNBULK2RVAL(rb_grn_column_cache->context,
184
+ &(rb_grn_column_cache->buffer),
185
+ rb_grn_column_cache->range,
186
+ self);
187
+ }
188
+
189
+ /*
190
+ * @overload close
191
+ * @return [void] Close the column cache.
192
+ */
193
+ static VALUE
194
+ rb_grn_column_cache_close (VALUE self)
195
+ {
196
+ RbGrnColumnCache *rb_grn_column_cache;
197
+
198
+ TypedData_Get_Struct(self,
199
+ RbGrnColumnCache,
200
+ &data_type,
201
+ rb_grn_column_cache);
202
+
203
+ if (rb_grn_column_cache->column_cache) {
204
+ GRN_OBJ_FIN(rb_grn_column_cache->context,
205
+ &(rb_grn_column_cache->buffer));
206
+ grn_column_cache_close(rb_grn_column_cache->context,
207
+ rb_grn_column_cache->column_cache);
208
+ rb_grn_column_cache->column_cache = NULL;
209
+ rb_grn_context_check(rb_grn_column_cache->context, self);
210
+ }
211
+
212
+ return Qnil;
213
+ }
214
+
215
+ void
216
+ rb_grn_init_column_cache (VALUE mGrn)
217
+ {
218
+ rb_cGrnColumnCache =
219
+ rb_define_class_under(mGrn, "ColumnCache", rb_cData);
220
+
221
+ rb_define_alloc_func(rb_cGrnColumnCache, rb_grn_column_cache_allocate);
222
+
223
+ rb_define_singleton_method(rb_cGrnColumnCache,
224
+ "open",
225
+ rb_grn_column_cache_s_open,
226
+ 1);
227
+
228
+ rb_define_method(rb_cGrnColumnCache,
229
+ "initialize",
230
+ rb_grn_column_cache_initialize,
231
+ 1);
232
+ rb_define_method(rb_cGrnColumnCache,
233
+ "[]",
234
+ rb_grn_column_cache_array_reference,
235
+ 1);
236
+ rb_define_method(rb_cGrnColumnCache,
237
+ "close",
238
+ rb_grn_column_cache_close,
239
+ 0);
240
+ }