[Groonga-commit] groonga/grnxx at c3381cf [master] Add aliases Value and ValueArg.

Back to archive index

susumu.yata null+****@clear*****
Tue May 28 20:32:56 JST 2013


susumu.yata	2013-05-28 20:32:56 +0900 (Tue, 28 May 2013)

  New Revision: c3381cfcbfe54f2bbd6b46cf83650b72608ee137
  https://github.com/groonga/grnxx/commit/c3381cfcbfe54f2bbd6b46cf83650b72608ee137

  Message:
    Add aliases Value and ValueArg.

  Modified files:
    lib/grnxx/map/bytes_store.cpp
    lib/grnxx/map/bytes_store.hpp

  Modified: lib/grnxx/map/bytes_store.cpp (+7 -6)
===================================================================
--- lib/grnxx/map/bytes_store.cpp    2013-05-28 20:19:55 +0900 (03abbbb)
+++ lib/grnxx/map/bytes_store.cpp    2013-05-28 20:32:56 +0900 (52b0338)
@@ -130,7 +130,8 @@ class BytesStoreImpl : public BytesStore {
                                 1>;
 
  public:
-  using BytesArg = typename Traits<Bytes>::ArgumentType;
+  using Value = Bytes;
+  using ValueArg = typename Traits<Bytes>::ArgumentType;
 
   BytesStoreImpl();
   virtual ~BytesStoreImpl();
@@ -140,9 +141,9 @@ class BytesStoreImpl : public BytesStore {
 
   uint32_t storage_node_id() const;
 
-  bool get(uint64_t bytes_id, Bytes *bytes);
+  bool get(uint64_t bytes_id, Value *bytes);
   bool unset(uint64_t bytes_id);
-  bool add(BytesArg bytes, uint64_t *bytes_id);
+  bool add(ValueArg bytes, uint64_t *bytes_id);
 
   bool sweep(Duration lifetime);
 
@@ -226,7 +227,7 @@ uint32_t BytesStoreImpl::storage_node_id() const {
   return storage_node_id_;
 }
 
-bool BytesStoreImpl::get(uint64_t bytes_id, Bytes *bytes) {
+bool BytesStoreImpl::get(uint64_t bytes_id, Value *bytes) {
   const uint64_t offset = get_offset(bytes_id);
   const uint32_t size = get_size(bytes_id);
   const uint32_t page_id = get_page_id(offset);
@@ -244,7 +245,7 @@ bool BytesStoreImpl::get(uint64_t bytes_id, Bytes *bytes) {
   }
   if (bytes) {
     const uint32_t offset_in_page = get_offset_in_page(offset);
-    *bytes = Bytes(&page[offset_in_page], size);
+    *bytes = Value(&page[offset_in_page], size);
   }
   return true;
 }
@@ -289,7 +290,7 @@ bool BytesStoreImpl::unset(uint64_t bytes_id) {
   return true;
 }
 
-bool BytesStoreImpl::add(BytesArg bytes, uint64_t *bytes_id) {
+bool BytesStoreImpl::add(ValueArg bytes, uint64_t *bytes_id) {
   if (bytes.size() > BYTES_STORE_MAX_SIZE) {
     GRNXX_ERROR() << "invalid argument: size = " << bytes.size();
     return false;

  Modified: lib/grnxx/map/bytes_store.hpp (+4 -3)
===================================================================
--- lib/grnxx/map/bytes_store.hpp    2013-05-28 20:19:55 +0900 (57f93c2)
+++ lib/grnxx/map/bytes_store.hpp    2013-05-28 20:32:56 +0900 (a782418)
@@ -34,7 +34,8 @@ namespace map {
 
 class BytesStore {
  public:
-  using BytesArg = typename Traits<Bytes>::ArgumentType;
+  using Value = Bytes;
+  using ValueArg = typename Traits<Bytes>::ArgumentType;
 
   BytesStore();
   virtual ~BytesStore();
@@ -51,11 +52,11 @@ class BytesStore {
   virtual uint32_t storage_node_id() const = 0;
 
   // Get a stored byte sequence.
-  virtual bool get(uint64_t bytes_id, Bytes *bytes) = 0;
+  virtual bool get(uint64_t bytes_id, Value *bytes) = 0;
   // Remove a stored byte sequence.
   virtual bool unset(uint64_t bytes_id) = 0;
   // Add a byte sequence.
-  virtual bool add(BytesArg bytes, uint64_t *bytes_id) = 0;
+  virtual bool add(ValueArg bytes, uint64_t *bytes_id) = 0;
 
   // Sweep empty pages whose modified time < (now - lifetime).
   virtual bool sweep(Duration lifetime) = 0;
-------------- next part --------------
HTML����������������������������...
Download 



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