[Groonga-commit] groonga/groonga [master] GRN_OBJ_RING_BUFFER appeared.

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2010年 8月 25日 (水) 13:35:00 JST


Daijiro MORI	2010-08-25 04:35:00 +0000 (Wed, 25 Aug 2010)

  New Revision: c53c01ad4335930dd314f54b6eb228cdd1c16906

  Log:
    GRN_OBJ_RING_BUFFER appeared.

  Modified files:
    groonga.h
    lib/proc.c
    lib/ql.c
    lib/store.c
    lib/util.c

  Modified: groonga.h (+1 -1)
===================================================================
--- groonga.h    2010-08-25 04:20:17 +0000 (6373c5b)
+++ groonga.h    2010-08-25 04:35:00 +0000 (3ad040f)
@@ -274,7 +274,7 @@ typedef unsigned short int grn_obj_flags;
 #define GRN_OBJ_WITH_SECTION           (0x01<<7)
 #define GRN_OBJ_WITH_WEIGHT            (0x01<<8)
 #define GRN_OBJ_WITH_POSITION          (0x01<<9)
-#define GRN_OBJ_WITH_BUFFER            (0x01<<10)
+#define GRN_OBJ_RING_BUFFER            (0x01<<10)
 
 #define GRN_OBJ_UNIT_MASK              (0x0f<<8)
 #define GRN_OBJ_UNIT_DOCUMENT_NONE     (0x00<<8)

  Modified: lib/proc.c (+3 -0)
===================================================================
--- lib/proc.c    2010-08-25 04:20:17 +0000 (cd0c718)
+++ lib/proc.c    2010-08-25 04:35:00 +0000 (66d04f9)
@@ -467,6 +467,9 @@ grn_parse_column_create_flags(grn_ctx *ctx, const char *nptr, const char *end)
     } else if (!memcmp(nptr, "WITH_POSITION", 13)) {
       flags |= GRN_OBJ_WITH_POSITION;
       nptr += 13;
+    } else if (!memcmp(nptr, "RING_BUFFER", 11)) {
+      flags |= GRN_OBJ_RING_BUFFER;
+      nptr += 11;
     } else {
       ERR(GRN_INVALID_ARGUMENT, "invalid flags option: %.*s", end - nptr, nptr);
       return 0;

  Modified: lib/ql.c (+1 -1)
===================================================================
--- lib/ql.c    2010-08-25 04:20:17 +0000 (43b0caf)
+++ lib/ql.c    2010-08-25 04:35:00 +0000 (fe4cd24)
@@ -1196,7 +1196,7 @@ ha_table(grn_ctx *ctx, grn_cell *args, grn_ql_co *co)
                 switch (*msg) {
                 case 'b' :
                 case 'B' :
-                  flags |= GRN_OBJ_WITH_BUFFER;
+                  flags |= GRN_OBJ_RING_BUFFER;
                   break;
                 case 'i' :
                 case 'I' :

  Modified: lib/store.c (+4 -4)
===================================================================
--- lib/store.c    2010-08-25 04:20:17 +0000 (42964a2)
+++ lib/store.c    2010-08-25 04:35:00 +0000 (1e0dfb5)
@@ -678,7 +678,7 @@ set_value(grn_ctx *ctx, grn_ja *ja, grn_id id, void *value, uint32_t value_len,
 {
   grn_rc rc = GRN_SUCCESS;
   grn_io_win iw;
-  if ((ja->header->flags & GRN_OBJ_WITH_BUFFER) &&
+  if ((ja->header->flags & GRN_OBJ_RING_BUFFER) &&
       value_len >= ja->header->max_element_size) {
     if ((rc = grn_ja_alloc(ctx, ja, id, value_len + sizeof(uint32_t), einfo, &iw))) {
       return rc;
@@ -709,7 +709,7 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
       uint32_t old_len;
       void *oldvalue = grn_ja_ref(ctx, ja, id, &jw, &old_len);
       if (oldvalue) {
-        if ((ja->header->flags & GRN_OBJ_WITH_BUFFER) &&
+        if ((ja->header->flags & GRN_OBJ_RING_BUFFER) &&
             old_len + value_len >= ja->header->max_element_size) {
           if (old_len >= ja->header->max_element_size) {
             byte *b = oldvalue;
@@ -758,7 +758,7 @@ grn_ja_put_raw(grn_ctx *ctx, grn_ja *ja, grn_id id,
       uint32_t old_len;
       void *oldvalue = grn_ja_ref(ctx, ja, id, &jw, &old_len);
       if (oldvalue) {
-        if ((ja->header->flags & GRN_OBJ_WITH_BUFFER) &&
+        if ((ja->header->flags & GRN_OBJ_RING_BUFFER) &&
             old_len + value_len >= ja->header->max_element_size) {
           if (old_len >= ja->header->max_element_size) {
             byte *b = oldvalue;
@@ -1072,7 +1072,7 @@ grn_ja_get_value(grn_ctx *ctx, grn_ja *ja, grn_id id, grn_obj *value)
     }
   }
   if ((v = grn_ja_ref(ctx, ja, id, &iw, &len))) {
-    if ((ja->header->flags & GRN_OBJ_WITH_BUFFER) &&
+    if ((ja->header->flags & GRN_OBJ_RING_BUFFER) &&
         len > ja->header->max_element_size) {
       byte *b = v;
       uint32_t el = len - sizeof(uint32_t);

  Modified: lib/util.c (+4 -0)
===================================================================
--- lib/util.c    2010-08-25 04:20:17 +0000 (a1947db)
+++ lib/util.c    2010-08-25 04:35:00 +0000 (92dc27d)
@@ -216,6 +216,10 @@ grn_store_inspect_body(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
     break;
   }
 
+  if (obj->header.flags & GRN_OBJ_RING_BUFFER) {
+    GRN_TEXT_PUTS(ctx, buf, " ring_buffer:true");
+  }
+
   return GRN_SUCCESS;
 }
 




Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index