[Groonga-commit] groonga/grnxx [master] Implement grnxx::alpha::BlobVector::write_to().

Back to archive index

susumu.yata null+****@clear*****
Tue Dec 4 13:21:49 JST 2012


susumu.yata	2012-12-04 13:21:49 +0900 (Tue, 04 Dec 2012)

  New Revision: 9c8be2e660c0e22b107e1505caca7583e3f79a2c
  https://github.com/groonga/grnxx/commit/9c8be2e660c0e22b107e1505caca7583e3f79a2c

  Log:
    Implement grnxx::alpha::BlobVector::write_to().

  Modified files:
    lib/alpha/blob_vector.cpp
    lib/alpha/blob_vector.hpp

  Modified: lib/alpha/blob_vector.cpp (+18 -2)
===================================================================
--- lib/alpha/blob_vector.cpp    2012-12-04 13:14:19 +0900 (aa19585)
+++ lib/alpha/blob_vector.cpp    2012-12-04 13:21:49 +0900 (8fd369f)
@@ -34,6 +34,19 @@ BlobVectorHeader::BlobVectorHeader(uint32_t cells_block_id)
     latest_large_value_block_id_(io::BLOCK_INVALID_ID),
     inter_process_mutex_() {}
 
+StringBuilder &BlobVectorHeader::write_to(StringBuilder &builder) const {
+  if (!builder) {
+    return builder;
+  }
+
+  builder << "{ cells_block_id = " << cells_block_id_
+          << ", value_store_block_id = " << value_store_block_id_
+          << ", next_medium_value_offset = " << next_medium_value_offset_
+          << ", latest_large_value_block_id = " << latest_large_value_block_id_
+          << ", inter_process_mutex = " << inter_process_mutex_;
+  return builder << " }";
+}
+
 StringBuilder &operator<<(StringBuilder &builder, BlobVectorType type) {
   switch (type) {
     case BLOB_VECTOR_NULL: {
@@ -186,8 +199,11 @@ StringBuilder &BlobVectorImpl::write_to(StringBuilder &builder) const {
     return builder;
   }
 
-  // TODO
-  return builder;
+  builder << "{ pool = " << pool_.path()
+          << ", block_info = " << *block_info_
+          << ", header = " << *header_
+          << ", inter_thread_mutex = " << inter_thread_mutex_;
+  return builder << " }";
 }
 
 void BlobVectorImpl::unlink(io::Pool pool, uint32_t block_id) {

  Modified: lib/alpha/blob_vector.hpp (+7 -0)
===================================================================
--- lib/alpha/blob_vector.hpp    2012-12-04 13:14:19 +0900 (8730ab8)
+++ lib/alpha/blob_vector.hpp    2012-12-04 13:21:49 +0900 (febf2e8)
@@ -88,6 +88,8 @@ class BlobVectorHeader {
     return &inter_process_mutex_;
   }
 
+  StringBuilder &write_to(StringBuilder &builder) const;
+
  private:
   uint32_t cells_block_id_;
   uint32_t value_store_block_id_;
@@ -96,6 +98,11 @@ class BlobVectorHeader {
   Mutex inter_process_mutex_;
 };
 
+inline StringBuilder &operator<<(StringBuilder &builder,
+                                 const BlobVectorHeader &header) {
+  return header.write_to(builder);
+}
+
 enum BlobVectorType : uint8_t {
   BLOB_VECTOR_NULL   = 0x00,
   BLOB_VECTOR_SMALL  = 0x10,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index