rroonga 6.0.5 → 6.0.7

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: 21579f26130016f0232888646e9b65d405c0f943
4
- data.tar.gz: f6a1817d3951f0b8f2553ca67235a50aef56677c
3
+ metadata.gz: 266ed1c5524c3ecf7a34caae961511c166f83fdc
4
+ data.tar.gz: a9bc9f5db05f31e635d521e265a8ea170371ac67
5
5
  SHA512:
6
- metadata.gz: 170e20bca5a5568bd99b646a3083b944f9b4ae5fc54f1e1322c3c5e8fc8b9423fd8d9e274341b189e192083ea4671b7c2eef40b774e24f6624cf58095de41590
7
- data.tar.gz: 7854edb1da626c4120602f8c61b188d11944e1bb0f6d1f4ee4e25fd0b9f810f555e18c570fa927f765f70c452715e444486c0dff562e886a9caccd553d6f95d5
6
+ metadata.gz: ba0d58609159717163d7cdc66bce45dda47d80a8e4ef27a670569edf8073c12ac5d7da3bcd1efea7ac8ac85fed33e047188728650b34c50a2260e960a0dbe209
7
+ data.tar.gz: d43410abb91b18bae1fc4da6f39e0dd160b8d02394dc64e6e0d95c54b90c42708dfc6f2482ad054eae5a85b36cb98f2f9b82ceef84e7e8b70faba3c3852e1372
data/doc/text/news.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # NEWS
2
2
 
3
+ ## 6.0.7: 2016-08-13 {#version-6-0-7}
4
+
5
+ ### Improvements
6
+
7
+ * Supported Groonga 6.0.7. Groonga 6.0.5 or older aren't supported.
8
+
9
+ * Improved integration with libraries that uses `at_exit` such as
10
+ test-unit.
11
+
12
+ ### Fixes
13
+
14
+ * {Groonga::FixSizeColumn#inspect}: Fixed wrong flags.
15
+
16
+ * {Groonga::VariableSizeColumn#inspect}: Fixed wrong flags.
17
+
3
18
  ## 6.0.5: 2016-07-15 {#version-6-0-5}
4
19
 
5
20
  ### Improvements
@@ -72,13 +72,15 @@ rb_grn_column_bind (RbGrnColumn *rb_column,
72
72
  grn_ctx *context, grn_obj *column)
73
73
  {
74
74
  RbGrnObject *rb_grn_object;
75
+ grn_column_flags flags;
75
76
  int column_type;
76
77
  unsigned char value_type;
77
78
 
78
79
  rb_grn_object = RB_GRN_OBJECT(rb_column);
79
80
  rb_grn_named_object_bind(RB_GRN_NAMED_OBJECT(rb_column), context, column);
80
81
 
81
- column_type = (column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK);
82
+ flags = grn_column_get_flags(context, column);
83
+ column_type = (flags & GRN_OBJ_COLUMN_TYPE_MASK);
82
84
  if (column_type == GRN_OBJ_COLUMN_VECTOR) {
83
85
  switch (rb_grn_object->range->header.type) {
84
86
  case GRN_TABLE_HASH_KEY:
@@ -644,18 +646,20 @@ rb_grn_column_vector_p (VALUE self)
644
646
  {
645
647
  grn_ctx *context;
646
648
  grn_obj *column;
649
+ grn_column_flags flags;
650
+ grn_column_flags column_type;
647
651
 
648
652
  rb_grn_column_deconstruct(SELF(self), &column, &context,
649
653
  NULL, NULL,
650
654
  NULL, NULL, NULL);
651
655
 
652
- if (column->header.type == GRN_COLUMN_VAR_SIZE &&
653
- ((column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) ==
654
- GRN_OBJ_COLUMN_VECTOR)) {
655
- return Qtrue;
656
- } else {
656
+ if (column->header.type != GRN_COLUMN_VAR_SIZE) {
657
657
  return Qfalse;
658
658
  }
659
+
660
+ flags = grn_column_get_flags(context, column);
661
+ column_type = (flags & GRN_OBJ_COLUMN_TYPE_MASK);
662
+ return CBOOL2RVAL(column_type == GRN_OBJ_COLUMN_VECTOR);
659
663
  }
660
664
 
661
665
  /*
@@ -671,22 +675,21 @@ rb_grn_column_scalar_p (VALUE self)
671
675
  {
672
676
  grn_ctx *context;
673
677
  grn_obj *column;
678
+ grn_column_flags flags;
679
+ grn_column_flags column_type;
674
680
 
675
681
  rb_grn_column_deconstruct(SELF(self), &column, &context,
676
682
  NULL, NULL,
677
683
  NULL, NULL, NULL);
678
684
 
679
685
  switch (column->header.type) {
680
- case GRN_COLUMN_FIX_SIZE:
686
+ case GRN_COLUMN_FIX_SIZE:
681
687
  return Qtrue;
682
- case GRN_COLUMN_VAR_SIZE:
683
- if ((column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) ==
684
- GRN_OBJ_COLUMN_SCALAR) {
685
- return Qtrue;
686
- } else {
687
- return Qfalse;
688
- }
689
- default:
688
+ case GRN_COLUMN_VAR_SIZE:
689
+ flags = grn_column_get_flags(context, column);
690
+ column_type = (flags & GRN_OBJ_COLUMN_TYPE_MASK);
691
+ return CBOOL2RVAL(column_type == GRN_OBJ_COLUMN_SCALAR);
692
+ default:
690
693
  return Qfalse;
691
694
  }
692
695
  }
@@ -701,12 +704,15 @@ static VALUE
701
704
  rb_grn_column_with_weight_p(VALUE self)
702
705
  {
703
706
  grn_obj *column;
707
+ grn_ctx *context;
708
+ grn_column_flags flags;
704
709
 
705
- rb_grn_column_deconstruct(SELF(self), &column, NULL,
710
+ rb_grn_column_deconstruct(SELF(self), &column, &context,
706
711
  NULL, NULL,
707
712
  NULL, NULL, NULL);
708
713
 
709
- return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_WEIGHT);
714
+ flags = grn_column_get_flags(context, column);
715
+ return CBOOL2RVAL(flags & GRN_OBJ_WITH_WEIGHT);
710
716
  }
711
717
 
712
718
  /*
@@ -175,29 +175,36 @@ rb_grn_context_unlink_database (grn_ctx *context)
175
175
  }
176
176
 
177
177
  static void
178
- rb_grn_context_fin (grn_ctx *context)
178
+ rb_grn_context_fin (RbGrnContext *rb_grn_context)
179
179
  {
180
- if (context->stat == GRN_CTX_FIN)
181
- return;
180
+ grn_ctx *context;
182
181
 
183
- if (!(context->flags & GRN_CTX_PER_DB)) {
184
- rb_grn_context_unlink_database(context);
182
+ context = rb_grn_context->context;
183
+
184
+ debug("context-fin: %p\n", context);
185
+
186
+ rb_grn_context_close_floating_objects(rb_grn_context);
187
+
188
+ if (context && context->stat != GRN_CTX_FIN && !rb_grn_exited) {
189
+ if (!(context->flags & GRN_CTX_PER_DB)) {
190
+ rb_grn_context_unlink_database(context);
191
+ }
192
+ grn_ctx_fin(context);
185
193
  }
186
- grn_ctx_fin(context);
194
+
195
+ debug("context-fin: %p: done\n", context);
196
+
197
+ rb_grn_context->context = NULL;
187
198
  }
188
199
 
189
200
  static void
190
201
  rb_grn_context_free (void *pointer)
191
202
  {
192
203
  RbGrnContext *rb_grn_context = pointer;
193
- grn_ctx *context;
194
204
 
195
- context = rb_grn_context->context;
196
- debug("context-free: %p\n", context);
197
- rb_grn_context_close_floating_objects(rb_grn_context);
198
- if (context && !rb_grn_exited)
199
- rb_grn_context_fin(context);
200
- debug("context-free: %p: done\n", context);
205
+ debug("context-free: %p\n", rb_grn_context);
206
+ rb_grn_context_fin(rb_grn_context);
207
+ debug("context-free: %p: done\n", rb_grn_context);
201
208
  xfree(rb_grn_context);
202
209
  }
203
210
 
@@ -248,7 +255,7 @@ rb_grn_context_to_exception (grn_ctx *context, VALUE related_object)
248
255
  return Qnil;
249
256
 
250
257
  exception_class = rb_grn_rc_to_exception(context->rc);
251
- message = rb_grn_rc_to_message(context->rc);
258
+ message = grn_rc_to_string(context->rc);
252
259
 
253
260
  GRN_OBJ_INIT(&bulk, GRN_BULK, 0, GRN_ID_NIL);
254
261
  GRN_TEXT_PUTS(context, &bulk, message);
@@ -482,16 +489,11 @@ rb_grn_context_initialize (int argc, VALUE *argv, VALUE self)
482
489
  static VALUE
483
490
  rb_grn_context_close (VALUE self)
484
491
  {
485
- int rc;
486
- grn_ctx *context;
487
492
  RbGrnContext *rb_grn_context;
488
493
 
489
- context = SELF(self);
490
- if (context) {
491
- rc = grn_ctx_fin(context);
492
- Data_Get_Struct(self, RbGrnContext, rb_grn_context);
493
- rb_grn_context->context = NULL;
494
- rb_grn_rc_check(rc, self);
494
+ Data_Get_Struct(self, RbGrnContext, rb_grn_context);
495
+ if (rb_grn_context->context) {
496
+ rb_grn_context_fin(rb_grn_context);
495
497
  }
496
498
 
497
499
  return Qnil;
@@ -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) 2014-2015 Masafumi Yokoyama <yokoyama@clear-code.com>
4
- Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
4
+ Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
5
5
 
6
6
  This library is free software; you can redistribute it and/or
7
7
  modify it under the terms of the GNU Lesser General Public
@@ -357,260 +357,6 @@ rb_grn_rc_to_exception (grn_rc rc)
357
357
  return exception;
358
358
  }
359
359
 
360
- const char *
361
- rb_grn_rc_to_message (grn_rc rc)
362
- {
363
- const char *message = NULL;
364
-
365
- switch (rc) {
366
- case GRN_SUCCESS:
367
- return NULL;
368
- break;
369
- case GRN_END_OF_DATA:
370
- message = "end of data";
371
- break;
372
- case GRN_UNKNOWN_ERROR:
373
- message = "unknown error";
374
- break;
375
- case GRN_OPERATION_NOT_PERMITTED:
376
- message = "operation not permitted";
377
- break;
378
- case GRN_NO_SUCH_FILE_OR_DIRECTORY:
379
- message = "no such file or directory";
380
- break;
381
- case GRN_NO_SUCH_PROCESS:
382
- message = "no such process";
383
- break;
384
- case GRN_INTERRUPTED_FUNCTION_CALL:
385
- message = "interrupted function call";
386
- break;
387
- case GRN_INPUT_OUTPUT_ERROR:
388
- message = "input output error";
389
- break;
390
- case GRN_NO_SUCH_DEVICE_OR_ADDRESS:
391
- message = "no such device or address";
392
- break;
393
- case GRN_ARG_LIST_TOO_LONG:
394
- message = "argument list too long";
395
- break;
396
- case GRN_EXEC_FORMAT_ERROR:
397
- message = "exec format error";
398
- break;
399
- case GRN_BAD_FILE_DESCRIPTOR:
400
- message = "bad file descriptor";
401
- break;
402
- case GRN_NO_CHILD_PROCESSES:
403
- message = "no child processes";
404
- break;
405
- case GRN_RESOURCE_TEMPORARILY_UNAVAILABLE:
406
- message = "resource temporarily unavailable";
407
- break;
408
- case GRN_NOT_ENOUGH_SPACE:
409
- message = "not enough space";
410
- break;
411
- case GRN_PERMISSION_DENIED:
412
- message = "permission denied";
413
- break;
414
- case GRN_BAD_ADDRESS:
415
- message = "bad address";
416
- break;
417
- case GRN_RESOURCE_BUSY:
418
- message = "resource busy";
419
- break;
420
- case GRN_FILE_EXISTS:
421
- message = "file exists";
422
- break;
423
- case GRN_IMPROPER_LINK:
424
- message = "improper link";
425
- break;
426
- case GRN_NO_SUCH_DEVICE:
427
- message = "no such device";
428
- break;
429
- case GRN_NOT_A_DIRECTORY:
430
- message = "not a directory";
431
- break;
432
- case GRN_IS_A_DIRECTORY:
433
- message = "is a directory";
434
- break;
435
- case GRN_INVALID_ARGUMENT:
436
- message = "invalid argument";
437
- break;
438
- case GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM:
439
- message = "too many open files in system";
440
- break;
441
- case GRN_TOO_MANY_OPEN_FILES:
442
- message = "too many open files";
443
- break;
444
- case GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION:
445
- message = "inappropriate I/O control operation";
446
- break;
447
- case GRN_FILE_TOO_LARGE:
448
- message = "file too large";
449
- break;
450
- case GRN_NO_SPACE_LEFT_ON_DEVICE:
451
- message = "no space left on device";
452
- break;
453
- case GRN_INVALID_SEEK:
454
- message = "invalid seek";
455
- break;
456
- case GRN_READ_ONLY_FILE_SYSTEM:
457
- message = "read only file system";
458
- break;
459
- case GRN_TOO_MANY_LINKS:
460
- message = "too many links";
461
- break;
462
- case GRN_BROKEN_PIPE:
463
- message = "broken pipe";
464
- break;
465
- case GRN_DOMAIN_ERROR:
466
- message = "domain error";
467
- break;
468
- case GRN_RESULT_TOO_LARGE:
469
- message = "result too large";
470
- break;
471
- case GRN_RESOURCE_DEADLOCK_AVOIDED:
472
- message = "resource deadlock avoided";
473
- break;
474
- case GRN_NO_MEMORY_AVAILABLE:
475
- message = "no memory available";
476
- break;
477
- case GRN_FILENAME_TOO_LONG:
478
- message = "filename too long";
479
- break;
480
- case GRN_NO_LOCKS_AVAILABLE:
481
- message = "no locks available";
482
- break;
483
- case GRN_FUNCTION_NOT_IMPLEMENTED:
484
- message = "function not implemented";
485
- break;
486
- case GRN_DIRECTORY_NOT_EMPTY:
487
- message = "directory not empty";
488
- break;
489
- case GRN_ILLEGAL_BYTE_SEQUENCE:
490
- message = "illegal byte sequence";
491
- break;
492
- case GRN_SOCKET_NOT_INITIALIZED:
493
- message = "socket not initialized";
494
- break;
495
- case GRN_OPERATION_WOULD_BLOCK:
496
- message = "operation would block";
497
- break;
498
- case GRN_ADDRESS_IS_NOT_AVAILABLE:
499
- message = "address is not available";
500
- break;
501
- case GRN_NETWORK_IS_DOWN:
502
- message = "network is down";
503
- break;
504
- case GRN_NO_BUFFER:
505
- message = "no buffer";
506
- break;
507
- case GRN_SOCKET_IS_ALREADY_CONNECTED:
508
- message = "socket is already connected";
509
- break;
510
- case GRN_SOCKET_IS_NOT_CONNECTED:
511
- message = "socket is not connected";
512
- break;
513
- case GRN_SOCKET_IS_ALREADY_SHUTDOWNED:
514
- message = "socket is already shutdowned";
515
- break;
516
- case GRN_OPERATION_TIMEOUT:
517
- message = "operation timeout";
518
- break;
519
- case GRN_CONNECTION_REFUSED:
520
- message = "connection refused";
521
- break;
522
- case GRN_RANGE_ERROR:
523
- message = "range error";
524
- break;
525
- case GRN_TOKENIZER_ERROR:
526
- message = "tokenizer error";
527
- break;
528
- case GRN_FILE_CORRUPT:
529
- message = "file corrupt";
530
- break;
531
- case GRN_INVALID_FORMAT:
532
- message = "invalid format";
533
- break;
534
- case GRN_OBJECT_CORRUPT:
535
- message = "object corrupt";
536
- break;
537
- case GRN_TOO_MANY_SYMBOLIC_LINKS:
538
- message = "too many symbolic links";
539
- break;
540
- case GRN_NOT_SOCKET:
541
- message = "not socket";
542
- break;
543
- case GRN_OPERATION_NOT_SUPPORTED:
544
- message = "operation not supported";
545
- break;
546
- case GRN_ADDRESS_IS_IN_USE:
547
- message = "address is in use";
548
- break;
549
- case GRN_ZLIB_ERROR:
550
- message = "ZLib error";
551
- break;
552
- case GRN_LZ4_ERROR:
553
- message = "LZ4 error";
554
- break;
555
- case GRN_STACK_OVER_FLOW:
556
- message = "stack over flow";
557
- break;
558
- case GRN_SYNTAX_ERROR:
559
- message = "syntax error";
560
- break;
561
- case GRN_RETRY_MAX:
562
- message = "retry max";
563
- break;
564
- case GRN_INCOMPATIBLE_FILE_FORMAT:
565
- message = "incompatible file format";
566
- break;
567
- case GRN_UPDATE_NOT_ALLOWED:
568
- message = "update isn't allowed";
569
- break;
570
- case GRN_TOO_SMALL_OFFSET:
571
- message = "too small offset";
572
- break;
573
- case GRN_TOO_LARGE_OFFSET:
574
- message = "too large offset";
575
- break;
576
- case GRN_TOO_SMALL_LIMIT:
577
- message = "too small limit";
578
- break;
579
- case GRN_CAS_ERROR:
580
- message = "CAS error";
581
- break;
582
- case GRN_UNSUPPORTED_COMMAND_VERSION:
583
- message = "unsupported command version";
584
- break;
585
- case GRN_NORMALIZER_ERROR:
586
- message = "normalizer error";
587
- break;
588
- case GRN_TOKEN_FILTER_ERROR:
589
- message = "token filter error";
590
- break;
591
- case GRN_COMMAND_ERROR:
592
- message = "command error";
593
- break;
594
- case GRN_PLUGIN_ERROR:
595
- message = "plugin error";
596
- break;
597
- case GRN_SCORER_ERROR:
598
- message = "scorer error";
599
- break;
600
- case GRN_CANCEL:
601
- message = "cancel";
602
- break;
603
- case GRN_WINDOW_FUNCTION_ERROR:
604
- message = "window function error";
605
- break;
606
- }
607
-
608
- if (!message)
609
- rb_raise(rb_eGrnError, "invalid return code: %d", rc);
610
-
611
- return message;
612
- }
613
-
614
360
  void
615
361
  rb_grn_rc_check (grn_rc rc, VALUE related_object)
616
362
  {
@@ -620,7 +366,7 @@ rb_grn_rc_check (grn_rc rc, VALUE related_object)
620
366
  exception = rb_grn_rc_to_exception(rc);
621
367
  if (NIL_P(exception))
622
368
  return;
623
- message = rb_grn_rc_to_message(rc);
369
+ message = grn_rc_to_string(rc);
624
370
 
625
371
  if (NIL_P(related_object))
626
372
  rb_raise(exception, "%s", message);
@@ -829,13 +829,16 @@ static VALUE
829
829
  rb_grn_index_column_with_section_p (VALUE self)
830
830
  {
831
831
  grn_obj *column;
832
+ grn_ctx *context;
833
+ grn_column_flags flags;
832
834
 
833
- rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
835
+ rb_grn_index_column_deconstruct(SELF(self), &column, &context,
834
836
  NULL, NULL,
835
837
  NULL, NULL, NULL, NULL, NULL,
836
838
  NULL, NULL);
837
839
 
838
- return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_SECTION);
840
+ flags = grn_column_get_flags(context, column);
841
+ return CBOOL2RVAL(flags & GRN_OBJ_WITH_SECTION);
839
842
  }
840
843
 
841
844
  /*
@@ -847,13 +850,16 @@ static VALUE
847
850
  rb_grn_index_column_with_weight_p (VALUE self)
848
851
  {
849
852
  grn_obj *column;
853
+ grn_ctx *context;
854
+ grn_column_flags flags;
850
855
 
851
- rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
856
+ rb_grn_index_column_deconstruct(SELF(self), &column, &context,
852
857
  NULL, NULL,
853
858
  NULL, NULL, NULL, NULL, NULL,
854
859
  NULL, NULL);
855
860
 
856
- return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_WEIGHT);
861
+ flags = grn_column_get_flags(context, column);
862
+ return CBOOL2RVAL(flags & GRN_OBJ_WITH_WEIGHT);
857
863
  }
858
864
 
859
865
  /*
@@ -865,13 +871,16 @@ static VALUE
865
871
  rb_grn_index_column_with_position_p (VALUE self)
866
872
  {
867
873
  grn_obj *column;
874
+ grn_ctx *context;
875
+ grn_column_flags flags;
868
876
 
869
- rb_grn_index_column_deconstruct(SELF(self), &column, NULL,
877
+ rb_grn_index_column_deconstruct(SELF(self), &column, &context,
870
878
  NULL, NULL,
871
879
  NULL, NULL, NULL, NULL, NULL,
872
880
  NULL, NULL);
873
881
 
874
- return CBOOL2RVAL(column->header.flags & GRN_OBJ_WITH_POSITION);
882
+ flags = grn_column_get_flags(context, column);
883
+ return CBOOL2RVAL(flags & GRN_OBJ_WITH_POSITION);
875
884
  }
876
885
 
877
886
  /*
@@ -898,6 +907,7 @@ rb_grn_index_column_open_cursor (int argc, VALUE *argv, VALUE self)
898
907
  {
899
908
  grn_ctx *context;
900
909
  grn_obj *column;
910
+ grn_column_flags column_flags;
901
911
  grn_obj *range_object;
902
912
  grn_table_cursor *table_cursor;
903
913
  grn_id rid_min = GRN_ID_NIL;
@@ -928,20 +938,22 @@ rb_grn_index_column_open_cursor (int argc, VALUE *argv, VALUE self)
928
938
  rb_table = GRNOBJECT2RVAL(Qnil, context, range_object, GRN_FALSE);
929
939
  rb_lexicon = rb_iv_get(rb_table_cursor, "@table");
930
940
 
941
+ column_flags = grn_column_get_flags(context, column);
942
+
931
943
  if (NIL_P(rb_with_section)) {
932
- flags |= column->header.flags & GRN_OBJ_WITH_SECTION;
944
+ flags |= column_flags & GRN_OBJ_WITH_SECTION;
933
945
  } else if (RVAL2CBOOL(rb_with_section)) {
934
946
  flags |= GRN_OBJ_WITH_SECTION;
935
947
  }
936
948
 
937
949
  if (NIL_P(rb_with_weight)) {
938
- flags |= column->header.flags & GRN_OBJ_WITH_WEIGHT;
950
+ flags |= column_flags & GRN_OBJ_WITH_WEIGHT;
939
951
  } else if (RVAL2CBOOL(rb_with_weight)) {
940
952
  flags |= GRN_OBJ_WITH_WEIGHT;
941
953
  }
942
954
 
943
955
  if (NIL_P(rb_with_position)) {
944
- flags |= column->header.flags & GRN_OBJ_WITH_POSITION;
956
+ flags |= column_flags & GRN_OBJ_WITH_POSITION;
945
957
  } else if (RVAL2CBOOL(rb_with_position)) {
946
958
  flags |= GRN_OBJ_WITH_POSITION;
947
959
  }
@@ -545,7 +545,7 @@ rb_grn_named_object_set_name (RbGrnNamedObject *rb_grn_named_object,
545
545
  RB_GRN_OBJECT(rb_grn_named_object)->context,
546
546
  RB_GRN_OBJECT(rb_grn_named_object)->object,
547
547
  rb_grn_named_object,
548
- grn_obj_type_to_string(RB_GRN_OBJECT(rb_grn_named_object)->header.type),
548
+ grn_obj_type_to_string(RB_GRN_OBJECT(rb_grn_named_object)->object->header.type),
549
549
  RB_GRN_OBJECT(rb_grn_named_object)->object->header.type,
550
550
  name_size, name);
551
551
  }
@@ -587,6 +587,10 @@ rb_grn_object_close_raw (RbGrnObject *rb_grn_object)
587
587
 
588
588
  rb_grn_object_deconstruct(rb_grn_object, &object, &context,
589
589
  NULL, NULL, NULL, NULL);
590
+ debug("object:close: %p:%p:%s\n",
591
+ context,
592
+ object,
593
+ object ? grn_obj_type_to_string(object->header.type) : "(null)");
590
594
  if (object && context) {
591
595
  if (rb_grn_object->have_finalizer) {
592
596
  rb_grn_object_run_finalizer(context, object, rb_grn_object);
@@ -595,6 +599,7 @@ rb_grn_object_close_raw (RbGrnObject *rb_grn_object)
595
599
  }
596
600
  grn_obj_close(context, object);
597
601
  }
602
+ debug("object:close: %p:%p: done\n", context, object);
598
603
  }
599
604
 
600
605
  /*
@@ -825,11 +830,21 @@ rb_grn_object_inspect_content_flags_with_label (VALUE inspected,
825
830
  grn_obj *object)
826
831
  {
827
832
  grn_obj_flags flags;
833
+ grn_column_flags column_flags = 0;
828
834
  VALUE inspected_flags;
829
835
 
830
836
  rb_str_cat2(inspected, "flags: ");
831
837
 
832
838
  flags = object->header.flags;
839
+ switch (object->header.type) {
840
+ case GRN_COLUMN_FIX_SIZE:
841
+ case GRN_COLUMN_VAR_SIZE:
842
+ case GRN_COLUMN_INDEX:
843
+ column_flags = grn_column_get_flags(context, object);
844
+ break;
845
+ default:
846
+ break;
847
+ }
833
848
 
834
849
  inspected_flags = rb_ary_new();
835
850
 
@@ -845,96 +860,113 @@ rb_grn_object_inspect_content_flags_with_label (VALUE inspected,
845
860
  }
846
861
 
847
862
  switch (object->header.type) {
848
- case GRN_COLUMN_FIX_SIZE:
849
- case GRN_COLUMN_VAR_SIZE:
850
- case GRN_TYPE:
863
+ case GRN_TYPE:
851
864
  if (flags & GRN_OBJ_KEY_VAR_SIZE) {
852
865
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_VAR_SIZE"));
853
866
  } else {
854
867
  switch (flags & GRN_OBJ_KEY_MASK) {
855
- case GRN_OBJ_KEY_UINT:
868
+ case GRN_OBJ_KEY_UINT:
856
869
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_UINT"));
857
870
  break;
858
- case GRN_OBJ_KEY_INT:
871
+ case GRN_OBJ_KEY_INT:
859
872
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_INT"));
860
873
  break;
861
- case GRN_OBJ_KEY_FLOAT:
874
+ case GRN_OBJ_KEY_FLOAT:
862
875
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_FLOAT"));
863
876
  break;
864
- case GRN_OBJ_KEY_GEO_POINT:
877
+ case GRN_OBJ_KEY_GEO_POINT:
865
878
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_GEO_POINT"));
866
879
  break;
867
- default:
880
+ default:
868
881
  break;
869
882
  }
870
883
  }
871
- break;
872
- default:
884
+ default:
873
885
  break;
874
886
  }
875
887
 
876
888
  switch (object->header.type) {
877
- case GRN_TABLE_HASH_KEY:
878
- case GRN_TABLE_PAT_KEY:
879
- case GRN_TABLE_DAT_KEY:
889
+ case GRN_TABLE_HASH_KEY:
890
+ case GRN_TABLE_PAT_KEY:
891
+ case GRN_TABLE_DAT_KEY:
880
892
  if (flags & GRN_OBJ_KEY_WITH_SIS)
881
893
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_WITH_SIS"));
882
894
  if (flags & GRN_OBJ_KEY_NORMALIZE)
883
895
  rb_ary_push(inspected_flags, rb_str_new_cstr("KEY_NORMALIZE"));
884
896
  break;
885
- default:
897
+ default:
886
898
  break;
887
899
  }
888
900
 
889
- if (0) {
890
- if (flags & GRN_OBJ_COLUMN_SCALAR)
901
+ switch (object->header.type) {
902
+ case GRN_COLUMN_FIX_SIZE:
903
+ case GRN_COLUMN_VAR_SIZE:
904
+ if (column_flags & GRN_OBJ_COLUMN_SCALAR) {
891
905
  rb_ary_push(inspected_flags, rb_str_new_cstr("COLUMN_SCALAR"));
892
- if (flags & GRN_OBJ_COLUMN_VECTOR)
906
+ } else if (column_flags & GRN_OBJ_COLUMN_VECTOR) {
893
907
  rb_ary_push(inspected_flags, rb_str_new_cstr("COLUMN_VECTOR"));
894
- if (flags & GRN_OBJ_COLUMN_INDEX)
895
- rb_ary_push(inspected_flags, rb_str_new_cstr("COLUMN_INDEX"));
908
+ }
909
+ break;
910
+ default:
911
+ break;
896
912
  }
897
913
 
898
914
  switch (object->header.type) {
899
- case GRN_COLUMN_FIX_SIZE:
900
- case GRN_COLUMN_VAR_SIZE:
901
- if (flags & GRN_OBJ_COMPRESS_ZLIB)
915
+ case GRN_COLUMN_FIX_SIZE:
916
+ case GRN_COLUMN_VAR_SIZE:
917
+ if (column_flags & GRN_OBJ_COMPRESS_ZLIB) {
902
918
  rb_ary_push(inspected_flags, rb_str_new_cstr("COMPRESS_ZLIB"));
903
- if (flags & GRN_OBJ_COMPRESS_LZ4)
919
+ } else if (column_flags & GRN_OBJ_COMPRESS_LZ4) {
904
920
  rb_ary_push(inspected_flags, rb_str_new_cstr("COMPRESS_LZ4"));
921
+ }
905
922
  break;
906
- case GRN_COLUMN_INDEX:
907
- if (flags & GRN_OBJ_WITH_SECTION)
923
+ case GRN_COLUMN_INDEX:
924
+ if (column_flags & GRN_OBJ_WITH_SECTION)
908
925
  rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_SECTION"));
909
- if (flags & GRN_OBJ_WITH_WEIGHT)
926
+ if (column_flags & GRN_OBJ_WITH_WEIGHT)
910
927
  rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_WEIGHT"));
911
- if (flags & GRN_OBJ_WITH_POSITION)
928
+ if (column_flags & GRN_OBJ_WITH_POSITION)
912
929
  rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_POSITION"));
913
930
  break;
914
- default:
931
+ default:
915
932
  break;
916
933
  }
917
934
 
918
- if (flags & GRN_OBJ_RING_BUFFER)
919
- rb_ary_push(inspected_flags, rb_str_new_cstr("RING_BUFFER"));
920
-
921
- if (flags & GRN_OBJ_WITH_SUBREC) {
922
- rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_SUBREC"));
923
-
924
- if (flags & GRN_OBJ_UNIT_DOCUMENT_SECTION)
925
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_DOCUMENT_SECTION"));
926
- if (flags & GRN_OBJ_UNIT_DOCUMENT_POSITION)
927
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_DOCUMENT_POSITION"));
928
-
929
- if (flags & GRN_OBJ_UNIT_SECTION_POSITION)
930
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_SECTION_POSITION"));
931
-
932
- if (flags & GRN_OBJ_UNIT_USERDEF_DOCUMENT)
933
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_USERDEF_DOCUMENT"));
934
- if (flags & GRN_OBJ_UNIT_USERDEF_SECTION)
935
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_USERDEF_SECTION"));
936
- if (flags & GRN_OBJ_UNIT_USERDEF_POSITION)
937
- rb_ary_push(inspected_flags, rb_str_new_cstr("UNIT_USERDEF_POSITION"));
935
+ switch (object->header.type) {
936
+ case GRN_TABLE_NO_KEY:
937
+ case GRN_TABLE_HASH_KEY:
938
+ case GRN_TABLE_PAT_KEY:
939
+ case GRN_TABLE_DAT_KEY:
940
+ if (flags & GRN_OBJ_RING_BUFFER)
941
+ rb_ary_push(inspected_flags, rb_str_new_cstr("RING_BUFFER"));
942
+
943
+ if (flags & GRN_OBJ_WITH_SUBREC) {
944
+ rb_ary_push(inspected_flags, rb_str_new_cstr("WITH_SUBREC"));
945
+
946
+ if (flags & GRN_OBJ_UNIT_DOCUMENT_SECTION)
947
+ rb_ary_push(inspected_flags,
948
+ rb_str_new_cstr("UNIT_DOCUMENT_SECTION"));
949
+ if (flags & GRN_OBJ_UNIT_DOCUMENT_POSITION)
950
+ rb_ary_push(inspected_flags,
951
+ rb_str_new_cstr("UNIT_DOCUMENT_POSITION"));
952
+
953
+ if (flags & GRN_OBJ_UNIT_SECTION_POSITION)
954
+ rb_ary_push(inspected_flags,
955
+ rb_str_new_cstr("UNIT_SECTION_POSITION"));
956
+
957
+ if (flags & GRN_OBJ_UNIT_USERDEF_DOCUMENT)
958
+ rb_ary_push(inspected_flags,
959
+ rb_str_new_cstr("UNIT_USERDEF_DOCUMENT"));
960
+ if (flags & GRN_OBJ_UNIT_USERDEF_SECTION)
961
+ rb_ary_push(inspected_flags,
962
+ rb_str_new_cstr("UNIT_USERDEF_SECTION"));
963
+ if (flags & GRN_OBJ_UNIT_USERDEF_POSITION)
964
+ rb_ary_push(inspected_flags,
965
+ rb_str_new_cstr("UNIT_USERDEF_POSITION"));
966
+ }
967
+ break;
968
+ default:
969
+ break;
938
970
  }
939
971
 
940
972
  rb_str_cat2(inspected, "<");
@@ -1274,19 +1306,23 @@ rb_grn_object_array_reference (VALUE self, VALUE rb_id)
1274
1306
  break;
1275
1307
  case GRN_COLUMN_VAR_SIZE:
1276
1308
  case GRN_COLUMN_FIX_SIZE:
1277
- switch (object->header.flags & GRN_OBJ_COLUMN_TYPE_MASK) {
1278
- case GRN_OBJ_COLUMN_VECTOR:
1279
- GRN_OBJ_INIT(&value, GRN_VECTOR, 0, range_id);
1280
- break;
1281
- case GRN_OBJ_COLUMN_SCALAR:
1282
- GRN_OBJ_INIT(&value, GRN_BULK, 0, range_id);
1283
- break;
1284
- default:
1285
- rb_raise(rb_eGrnError, "unsupported column type: %u: %s",
1286
- range_type, rb_grn_inspect(self));
1287
- break;
1288
- }
1289
- break;
1309
+ {
1310
+ grn_column_flags column_flags;
1311
+ column_flags = grn_column_get_flags(context, object);
1312
+ switch (column_flags & GRN_OBJ_COLUMN_TYPE_MASK) {
1313
+ case GRN_OBJ_COLUMN_VECTOR:
1314
+ GRN_OBJ_INIT(&value, GRN_VECTOR, 0, range_id);
1315
+ break;
1316
+ case GRN_OBJ_COLUMN_SCALAR:
1317
+ GRN_OBJ_INIT(&value, GRN_BULK, 0, range_id);
1318
+ break;
1319
+ default:
1320
+ rb_raise(rb_eGrnError, "unsupported column type: %u: %s",
1321
+ range_type, rb_grn_inspect(self));
1322
+ break;
1323
+ }
1324
+ }
1325
+ break;
1290
1326
  case GRN_COLUMN_INDEX:
1291
1327
  GRN_UINT32_INIT(&value, 0);
1292
1328
  break;
@@ -25,7 +25,7 @@ rb_grn_table_sort_keys_fill (grn_ctx *context,
25
25
  VALUE rb_sort_keys,
26
26
  VALUE rb_table)
27
27
  {
28
- int i;
28
+ size_t i;
29
29
 
30
30
  for (i = 0; i < n_sort_keys; i++) {
31
31
  VALUE rb_sort_key;
@@ -242,7 +242,7 @@ rb_grn_table_define_column (int argc, VALUE *argv, VALUE self)
242
242
  grn_obj *value_type, *column;
243
243
  char *name = NULL, *path = NULL;
244
244
  unsigned name_size = 0;
245
- grn_obj_flags flags = 0;
245
+ grn_column_flags flags = 0;
246
246
  VALUE rb_name, rb_value_type;
247
247
  VALUE options, rb_path, rb_persistent, rb_compress, rb_type, rb_with_weight;
248
248
  VALUE columns;
@@ -372,7 +372,7 @@ rb_grn_table_define_index_column (int argc, VALUE *argv, VALUE self)
372
372
  grn_obj *value_type, *column;
373
373
  char *name = NULL, *path = NULL;
374
374
  unsigned name_size = 0;
375
- grn_obj_flags flags = GRN_OBJ_COLUMN_INDEX;
375
+ grn_column_flags flags = GRN_OBJ_COLUMN_INDEX;
376
376
  VALUE rb_name, rb_value_type;
377
377
  VALUE options, rb_path, rb_persistent;
378
378
  VALUE rb_with_section, rb_with_weight, rb_with_position;
@@ -28,14 +28,16 @@ rb_grn_variable_size_column_bind (RbGrnVariableSizeColumn *rb_column,
28
28
  grn_ctx *context, grn_obj *column)
29
29
  {
30
30
  RbGrnObject *rb_grn_object;
31
- int column_type;
31
+ grn_column_flags flags;
32
+ grn_column_flags column_type;
32
33
  unsigned char value_type;
33
34
 
34
35
  rb_grn_object = RB_GRN_OBJECT(rb_column);
35
36
  rb_grn_column_bind(RB_GRN_COLUMN(rb_column), context, column);
36
37
 
37
38
  rb_column->element_value = NULL;
38
- column_type = (column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK);
39
+ flags = grn_column_get_flags(context, column);
40
+ column_type = (flags & GRN_OBJ_COLUMN_TYPE_MASK);
39
41
  if (column_type != GRN_OBJ_COLUMN_VECTOR) {
40
42
  return;
41
43
  }
@@ -51,7 +53,7 @@ rb_grn_variable_size_column_bind (RbGrnVariableSizeColumn *rb_column,
51
53
  value_type = GRN_VECTOR;
52
54
  break;
53
55
  }
54
- if (column->header.flags & GRN_OBJ_WITH_WEIGHT) {
56
+ if (flags & GRN_OBJ_WITH_WEIGHT) {
55
57
  rb_column->element_value = grn_obj_open(context, value_type, 0,
56
58
  rb_grn_object->range_id);
57
59
  }
@@ -161,6 +163,7 @@ rb_grn_variable_size_column_array_reference (VALUE self, VALUE rb_id)
161
163
  {
162
164
  grn_ctx *context = NULL;
163
165
  grn_obj *column, *range;
166
+ grn_column_flags flags;
164
167
  grn_id id;
165
168
  grn_obj *value;
166
169
  VALUE rb_value;
@@ -171,7 +174,8 @@ rb_grn_variable_size_column_array_reference (VALUE self, VALUE rb_id)
171
174
  NULL, NULL, &value, NULL,
172
175
  NULL, &range);
173
176
 
174
- if (!(column->header.flags & GRN_OBJ_WITH_WEIGHT)) {
177
+ flags = grn_column_get_flags(context, column);
178
+ if (!(flags & GRN_OBJ_WITH_WEIGHT)) {
175
179
  return rb_call_super(1, &rb_id);
176
180
  }
177
181
 
@@ -373,6 +377,7 @@ rb_grn_variable_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
373
377
  {
374
378
  grn_ctx *context = NULL;
375
379
  grn_obj *column, *range;
380
+ grn_column_flags column_flags;
376
381
  grn_rc rc;
377
382
  grn_id id;
378
383
  grn_obj *value, *element_value;
@@ -382,7 +387,8 @@ rb_grn_variable_size_column_array_set (VALUE self, VALUE rb_id, VALUE rb_value)
382
387
  NULL, NULL, &value, &element_value,
383
388
  NULL, &range);
384
389
 
385
- if (!(column->header.flags & GRN_OBJ_WITH_WEIGHT)) {
390
+ column_flags = grn_column_get_flags(context, column);
391
+ if (!(column_flags & GRN_OBJ_WITH_WEIGHT)) {
386
392
  VALUE args[2];
387
393
  args[0] = rb_id;
388
394
  args[1] = rb_value;
@@ -469,7 +475,7 @@ rb_grn_variable_size_column_compressed_p (int argc, VALUE *argv, VALUE self)
469
475
  RbGrnVariableSizeColumn *rb_grn_column;
470
476
  grn_ctx *context = NULL;
471
477
  grn_obj *column;
472
- grn_obj_flags flags;
478
+ grn_column_flags flags;
473
479
  VALUE type;
474
480
  grn_bool compressed_p = GRN_FALSE;
475
481
  grn_bool accept_any_type = GRN_FALSE;
@@ -500,7 +506,7 @@ rb_grn_variable_size_column_compressed_p (int argc, VALUE *argv, VALUE self)
500
506
  NULL, NULL,
501
507
  NULL, NULL);
502
508
 
503
- flags = column->header.flags;
509
+ flags = grn_column_get_flags(context, column);
504
510
  switch (flags & GRN_OBJ_COMPRESS_MASK) {
505
511
  case GRN_OBJ_COMPRESS_ZLIB:
506
512
  if (accept_any_type || need_zlib_check) {
data/ext/groonga/rb-grn.h CHANGED
@@ -99,7 +99,7 @@ RB_GRN_BEGIN_DECLS
99
99
 
100
100
  #define RB_GRN_MAJOR_VERSION 6
101
101
  #define RB_GRN_MINOR_VERSION 0
102
- #define RB_GRN_MICRO_VERSION 5
102
+ #define RB_GRN_MICRO_VERSION 7
103
103
 
104
104
  #define RB_GRN_OBJECT(object) ((RbGrnObject *)(object))
105
105
  #define RB_GRN_NAMED_OBJECT(object) ((RbGrnNamedObject *)(object))
@@ -369,7 +369,6 @@ void rb_grn_init_id (VALUE mGrn);
369
369
  void rb_grn_init_name (VALUE mGrn);
370
370
 
371
371
  VALUE rb_grn_rc_to_exception (grn_rc rc);
372
- const char *rb_grn_rc_to_message (grn_rc rc);
373
372
  void rb_grn_rc_check (grn_rc rc,
374
373
  VALUE related_object);
375
374
 
@@ -21,13 +21,14 @@
21
21
 
22
22
  grn_bool rb_grn_exited = GRN_FALSE;
23
23
 
24
- static void
24
+ static VALUE
25
25
  finish_groonga (VALUE data)
26
26
  {
27
27
  debug("finish\n");
28
28
  grn_fin();
29
29
  rb_grn_exited = GRN_TRUE;
30
30
  debug("finish: done\n");
31
+ return Qnil;
31
32
  }
32
33
 
33
34
  /*
@@ -212,7 +213,7 @@ Init_groonga (void)
212
213
  rb_grn_init_exception(mGrn);
213
214
 
214
215
  rb_grn_rc_check(grn_init(), Qnil);
215
- rb_set_end_proc(finish_groonga, Qnil);
216
+ rb_define_finalizer(mGrn, rb_proc_new(finish_groonga, Qnil));
216
217
 
217
218
  rb_grn_init_version(mGrn);
218
219
  rb_grn_init_lock_timeout(mGrn);
data/rroonga-build.rb CHANGED
@@ -18,15 +18,15 @@ module RroongaBuild
18
18
  module RequiredGroongaVersion
19
19
  MAJOR = 6
20
20
  MINOR = 0
21
- MICRO = 5
21
+ MICRO = 7
22
22
  VERSION = [MAJOR, MINOR, MICRO]
23
- RELEASED_DATE = Time.utc(2016, 6, 29)
23
+ RELEASED_DATE = Time.utc(2016, 7, 29)
24
24
  end
25
25
 
26
26
  module LatestGroongaVersion
27
27
  MAJOR = 6
28
28
  MINOR = 0
29
- MICRO = 5
29
+ MICRO = 7
30
30
  VERSION = [MAJOR, MINOR, MICRO]
31
31
  end
32
32
 
@@ -139,7 +139,7 @@ class FixSizeColumnTest < Test::Unit::TestCase
139
139
  "path: <#{@n_viewed_column_path}>, " +
140
140
  "domain: <Bookmarks>, " +
141
141
  "range: <Int32>, " +
142
- "flags: <KEY_INT>" +
142
+ "flags: <>" +
143
143
  ">",
144
144
  @n_viewed.inspect)
145
145
  end
data/test/test-schema.rb CHANGED
@@ -371,7 +371,7 @@ class SchemaTest < Test::Unit::TestCase
371
371
  "path: <#{path}>, " +
372
372
  "domain: <Posts>, " +
373
373
  "range: <Niku>, " +
374
- "flags: <KEY_VAR_SIZE|COMPRESS_LZ4>>",
374
+ "flags: <COLUMN_VECTOR|COMPRESS_LZ4>>",
375
375
  column.inspect)
376
376
  end
377
377
  end
@@ -103,7 +103,7 @@ class VariableSizeColumnTest < Test::Unit::TestCase
103
103
  "path: <#{@users_name_column_path}>, " +
104
104
  "domain: <Users>, " +
105
105
  "range: <ShortText>, " +
106
- "flags: <KEY_VAR_SIZE>" +
106
+ "flags: <>" +
107
107
  ">",
108
108
  @name.inspect)
109
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rroonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.5
4
+ version: 6.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-07-15 00:00:00.000000000 Z
15
+ date: 2016-08-13 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config