rroonga 10.0.2 → 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -0
  3. data/doc/text/news.md +36 -0
  4. data/ext/groonga/extconf.rb +14 -2
  5. data/ext/groonga/rb-grn-accessor.c +2 -2
  6. data/ext/groonga/rb-grn-column-cache.c +3 -3
  7. data/ext/groonga/rb-grn-column.c +4 -4
  8. data/ext/groonga/rb-grn-context.c +82 -58
  9. data/ext/groonga/rb-grn-data-column.c +4 -4
  10. data/ext/groonga/rb-grn-database.c +45 -26
  11. data/ext/groonga/rb-grn-double-array-trie.c +2 -2
  12. data/ext/groonga/rb-grn-encoding-support.c +2 -2
  13. data/ext/groonga/rb-grn-exception.c +14 -0
  14. data/ext/groonga/rb-grn-expression.c +3 -3
  15. data/ext/groonga/rb-grn-fix-size-column.c +2 -2
  16. data/ext/groonga/rb-grn-flushable.c +2 -1
  17. data/ext/groonga/rb-grn-hash.c +2 -2
  18. data/ext/groonga/rb-grn-index-column.c +3 -3
  19. data/ext/groonga/rb-grn-index-cursor.c +2 -2
  20. data/ext/groonga/rb-grn-inverted-index-cursor.c +3 -3
  21. data/ext/groonga/rb-grn-object.c +30 -9
  22. data/ext/groonga/rb-grn-operator.c +100 -259
  23. data/ext/groonga/rb-grn-patricia-trie.c +2 -2
  24. data/ext/groonga/rb-grn-plugin.c +34 -22
  25. data/ext/groonga/rb-grn-request-timer-id.c +2 -2
  26. data/ext/groonga/rb-grn-snippet.c +3 -3
  27. data/ext/groonga/rb-grn-table-cursor-key-support.c +2 -2
  28. data/ext/groonga/rb-grn-table-cursor.c +3 -3
  29. data/ext/groonga/rb-grn-table-key-support.c +3 -3
  30. data/ext/groonga/rb-grn-table.c +63 -45
  31. data/ext/groonga/rb-grn-variable-size-column.c +2 -2
  32. data/ext/groonga/rb-grn-variable.c +2 -2
  33. data/ext/groonga/rb-grn.h +8 -5
  34. data/ext/groonga/rb-groonga.c +5 -1
  35. data/lib/groonga/context.rb +32 -0
  36. data/rroonga-build.rb +5 -4
  37. data/rroonga.gemspec +5 -2
  38. data/test/groonga-test-utils.rb +3 -0
  39. data/test/run-test.rb +1 -1
  40. data/test/test-index-column.rb +3 -3
  41. data/test/test-logger.rb +2 -0
  42. data/test/test-ractor.rb +65 -0
  43. data/test/test-remote.rb +16 -0
  44. data/test/test-table-arrow.rb +21 -9
  45. 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-2016 Kouhei Sutou <kou@clear-code.com>
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 *)DATA_PTR(object))
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(DATA_PTR(object)))
22
+ #define SELF(object) (RB_GRN_OBJECT(RTYPEDDATA_DATA(object)))
22
23
 
23
24
  VALUE rb_mGrnFlushable;
24
25
 
@@ -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-2016 Kouhei Sutou <kou@clear-code.com>
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 *)DATA_PTR(object))
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) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
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 *)DATA_PTR(object))
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 Sutou <kou@clear-code.com>
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 *)DATA_PTR(object))
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 Sutou <kou@clear-code.com>
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 *)DATA_PTR(object))
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", rb_cData);
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",
@@ -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-2018 Kouhei Sutou <kou@clear-code.com>
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 *)DATA_PTR(object))
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
- Data_Get_Struct(object, RbGrnObject, rb_grn_object);
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 Data_Wrap_Struct(klass, NULL, rb_grn_object_free, NULL);
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
- Data_Get_Struct(rb_context, RbGrnContext, rb_grn_context);
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
- DATA_PTR(self) = rb_grn_object;
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", rb_cData);
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);