Switch BlobType fields over to Blob

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/4313e9a7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/4313e9a7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/4313e9a7

Branch: refs/heads/master
Commit: 4313e9a7b540347de312ba9560d0aaa7f6dcde4d
Parents: 2aa3da2
Author: Nick Wellnhofer <[email protected]>
Authored: Mon May 4 15:55:33 2015 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Tue May 5 11:23:05 2015 +0200

----------------------------------------------------------------------
 c/src/Lucy/Index/DocReader.c      |  5 ++---
 c/src/Lucy/Index/Inverter.c       | 10 ++++------
 core/Lucy/Index/DocWriter.c       |  5 +++--
 core/Lucy/Index/Inverter.c        |  2 +-
 core/Lucy/Index/SortFieldWriter.c | 11 ++++++-----
 perl/xs/Lucy/Index/Inverter.c     |  8 ++++----
 6 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index 0e97ecf..a908680 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -20,7 +20,7 @@
 #define LUCY_USE_SHORT_NAMES
 
 #include "Lucy/Index/DocReader.h"
-#include "Clownfish/ByteBuf.h"
+#include "Clownfish/Blob.h"
 #include "Clownfish/String.h"
 #include "Clownfish/Err.h"
 #include "Clownfish/Hash.h"
@@ -83,8 +83,7 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t 
doc_id) {
                     uint32_t value_len = InStream_Read_C32(dat_in);
                     char *buf = (char*)MALLOCATE(value_len);
                     InStream_Read_Bytes(dat_in, buf, value_len);
-                    value = (Obj*)BB_new_steal_bytes(
-                                buf, value_len, value_len);
+                    value = (Obj*)Blob_new_steal(buf, value_len);
                     break;
                 }
             case FType_FLOAT32:

http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/c/src/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c
index 8393455..23622d8 100644
--- a/c/src/Lucy/Index/Inverter.c
+++ b/c/src/Lucy/Index/Inverter.c
@@ -20,7 +20,7 @@
 #define LUCY_USE_SHORT_NAMES
 
 #include "Lucy/Index/Inverter.h"
-#include "Clownfish/ByteBuf.h"
+#include "Clownfish/Blob.h"
 #include "Clownfish/String.h"
 #include "Clownfish/Err.h"
 #include "Clownfish/Hash.h"
@@ -86,11 +86,9 @@ Inverter_Invert_Doc_IMP(Inverter *self, Doc *doc) {
                     break;
                 }
             case FType_BLOB: {
-                    ByteBuf *byte_buf
-                        = (ByteBuf*)CERTIFY(obj, BYTEBUF);
-                    ViewByteBuf *value
-                        = (ViewByteBuf*)inventry_ivars->value;
-                    ViewBB_Assign(value, byte_buf);
+                    Blob *blob = (Blob*)CERTIFY(obj, BLOB);
+                    DECREF(inventry_ivars->value);
+                    inventry_ivars->value = INCREF(blob);
                     break;
                 }
             case FType_INT32: {

http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/core/Lucy/Index/DocWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c
index 8b70d14..07129a7 100644
--- a/core/Lucy/Index/DocWriter.c
+++ b/core/Lucy/Index/DocWriter.c
@@ -17,6 +17,7 @@
 #define C_LUCY_DOCWRITER
 #include "Lucy/Util/ToolSet.h"
 
+#include "Clownfish/Blob.h"
 #include "Lucy/Index/DocWriter.h"
 #include "Lucy/Document/Doc.h"
 #include "Lucy/Index/DocReader.h"
@@ -122,8 +123,8 @@ DocWriter_Add_Inverted_Doc_IMP(DocWriter *self, Inverter 
*inverter,
                     break;
                 }
                 case FType_BLOB: {
-                    const char *buf  = BB_Get_Buf((ByteBuf*)value);
-                    size_t      size = BB_Get_Size((ByteBuf*)value);
+                    const char *buf  = Blob_Get_Buf((Blob*)value);
+                    size_t      size = Blob_Get_Size((Blob*)value);
                     OutStream_Write_C32(dat_out, size);
                     OutStream_Write_Bytes(dat_out, buf, size);
                     break;

http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/core/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c
index dc356b6..23dd0f6 100644
--- a/core/Lucy/Index/Inverter.c
+++ b/core/Lucy/Index/Inverter.c
@@ -218,7 +218,7 @@ InvEntry_init(InverterEntry *self, Schema *schema, String 
*field,
                 ivars->value = NULL;
                 break;
             case FType_BLOB:
-                ivars->value = (Obj*)ViewBB_new(NULL, 0);
+                ivars->value = NULL;
                 break;
             case FType_INT32:
                 ivars->value = (Obj*)Int32_new(0);

http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c 
b/core/Lucy/Index/SortFieldWriter.c
index ff41e73..b40fae7 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -35,6 +35,7 @@
 #include "Lucy/Store/Folder.h"
 #include "Lucy/Store/InStream.h"
 #include "Lucy/Store/OutStream.h"
+#include "Clownfish/Blob.h"
 #include "Clownfish/Util/Memory.h"
 #include "Clownfish/Util/SortUtils.h"
 
@@ -126,7 +127,7 @@ SortFieldWriter_init(SortFieldWriter *self, Schema *schema,
         ivars->var_width = true;
     }
     else if (ivars->prim_id == FType_BLOB) {
-        ivars->mem_per_entry += Class_Get_Obj_Alloc_Size(BYTEBUF);
+        ivars->mem_per_entry += Class_Get_Obj_Alloc_Size(BLOB);
         ivars->var_width = true;
     }
     else {
@@ -180,7 +181,7 @@ SortFieldWriter_Add_IMP(SortFieldWriter *self, int32_t 
doc_id, Obj *value) {
         Counter_Add(counter, size);
     }
     else if (ivars->prim_id == FType_BLOB) {
-        int64_t size = BB_Get_Size((ByteBuf*)value) + 1;
+        int64_t size = Blob_Get_Size((Blob*)value) + 1;
         size = SI_increase_to_word_multiple(size);
         Counter_Add(counter, size);
     }
@@ -266,11 +267,11 @@ S_write_val(Obj *val, int8_t prim_id, OutStream *ix_out, 
OutStream *dat_out,
                     break;
                 }
             case FType_BLOB: {
-                    ByteBuf *byte_buf = (ByteBuf*)val;
+                    Blob *blob = (Blob*)val;
                     int64_t dat_pos = OutStream_Tell(dat_out) - dat_start;
                     OutStream_Write_I64(ix_out, dat_pos);
-                    OutStream_Write_Bytes(dat_out, BB_Get_Buf(byte_buf),
-                                          BB_Get_Size(byte_buf));
+                    OutStream_Write_Bytes(dat_out, Blob_Get_Buf(blob),
+                                          Blob_Get_Size(blob));
                     break;
                 }
             case FType_INT32: {

http://git-wip-us.apache.org/repos/asf/lucy/blob/4313e9a7/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 264548e..9f3d6ef 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -20,7 +20,7 @@
 #include "Lucy/Index/Inverter.h"
 #include "Lucy/Document/Doc.h"
 #include "Lucy/Index/Segment.h"
-#include "Clownfish/ByteBuf.h"
+#include "Clownfish/Blob.h"
 #include "Lucy/Plan/FieldType.h"
 #include "Lucy/Plan/BlobType.h"
 #include "Lucy/Plan/NumericType.h"
@@ -109,9 +109,9 @@ LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc 
*doc) {
             case lucy_FType_BLOB: {
                     STRLEN val_len;
                     char *val_ptr = SvPV(value_sv, val_len);
-                    cfish_ViewByteBuf *value
-                        = (cfish_ViewByteBuf*)entry_ivars->value;
-                    CFISH_ViewBB_Assign_Bytes(value, val_ptr, val_len);
+                    CFISH_DECREF(entry_ivars->value);
+                    entry_ivars->value
+                        = (cfish_Obj*)cfish_Blob_new_wrap(val_ptr, val_len);
                     break;
                 }
             case lucy_FType_INT32: {

Reply via email to