[Groonga-commit] groonga/grnxx [master] Add an interface prototype, grnxx::map::DoubleArray.

Back to archive index

susumu.yata null+****@clear*****
Wed Feb 13 09:43:47 JST 2013


susumu.yata	2013-02-13 09:43:47 +0900 (Wed, 13 Feb 2013)

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

  Log:
    Add an interface prototype, grnxx::map::DoubleArray.

  Added files:
    lib/map/Makefile.am
    lib/map/double_array.cpp
    lib/map/double_array.hpp
  Modified files:
    configure.ac
    lib/Makefile.am

  Modified: configure.ac (+1 -0)
===================================================================
--- configure.ac    2013-02-13 09:16:10 +0900 (961f51c)
+++ configure.ac    2013-02-13 09:43:47 +0900 (7967f5a)
@@ -47,6 +47,7 @@ AC_CONFIG_FILES([Makefile
                  lib/alpha/Makefile
                  lib/db/Makefile
                  lib/io/Makefile
+                 lib/map/Makefile
                  src/Makefile
                  test/Makefile])
 AC_OUTPUT

  Modified: lib/Makefile.am (+3 -2)
===================================================================
--- lib/Makefile.am    2013-02-13 09:16:10 +0900 (cfca9cc)
+++ lib/Makefile.am    2013-02-13 09:43:47 +0900 (496a9bd)
@@ -1,11 +1,12 @@
-SUBDIRS = alpha db io
+SUBDIRS = alpha db io map
 
 lib_LTLIBRARIES = libgrnxx.la
 
 libgrnxx_la_LIBADD =		\
 	alpha/libgrnxx_alpha.la	\
 	db/libgrnxx_db.la	\
-	io/libgrnxx_io.la
+	io/libgrnxx_io.la	\
+	map/libgrnxx_map.la
 
 libgrnxx_la_LDFLAGS = @AM_LTLDFLAGS@
 

  Added: lib/map/Makefile.am (+10 -0) 100644
===================================================================
--- /dev/null
+++ lib/map/Makefile.am    2013-02-13 09:43:47 +0900 (f0f0fee)
@@ -0,0 +1,10 @@
+noinst_LTLIBRARIES = libgrnxx_map.la
+
+libgrnxx_map_la_LDFLAGS = @AM_LTLDFLAGS@
+
+libgrnxx_map_la_SOURCES =	\
+	double_array.cpp
+
+libgrnxx_map_includedir = ${includedir}/grnxx/map
+libgrnxx_map_include_HEADERS =	\
+	double_array.hpp

  Added: lib/map/double_array.cpp (+32 -0) 100644
===================================================================
--- /dev/null
+++ lib/map/double_array.cpp    2013-02-13 09:43:47 +0900 (1847f8c)
@@ -0,0 +1,32 @@
+/*
+  Copyright (C) 2013  Brazil, Inc.
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#include "double_array.hpp"
+
+//#include "../exception.hpp"
+//#include "../lock.hpp"
+//#include "../logger.hpp"
+
+namespace grnxx {
+namespace map {
+
+DoubleArrayOptions::DoubleArrayOptions() : type(DOUBLE_ARRAY_UNKNOWN) {}
+
+DoubleArrayHeader::DoubleArrayHeader() : type(DOUBLE_ARRAY_UNKNOWN) {}
+
+}  // namespace map
+}  // namespace grnxx

  Added: lib/map/double_array.hpp (+71 -0) 100644
===================================================================
--- /dev/null
+++ lib/map/double_array.hpp    2013-02-13 09:43:47 +0900 (0e68df9)
@@ -0,0 +1,71 @@
+/*
+  Copyright (C) 2013  Brazil, Inc.
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#ifndef GRNXX_MAP_DOUBLE_ARRAY_HPP
+#define GRNXX_MAP_DOUBLE_ARRAY_HPP
+
+#include "../map.hpp"
+
+namespace grnxx {
+namespace map {
+
+enum DoubleArrayType : int32_t {
+  DOUBLE_ARRAY_UNKNOWN = 0,
+  DOUBLE_ARRAY_BASIC   = 1,
+  DOUBLE_ARRAY_LARGE   = 2
+};
+
+struct DoubleArrayOptions {
+  DoubleArrayType type;
+
+  DoubleArrayOptions();
+};
+
+struct DoubleArrayHeader {
+  DoubleArrayType type;
+
+  DoubleArrayHeader();
+};
+
+class DoubleArray : public Map {
+ public:
+  ~DoubleArray();
+
+  static DoubleArray *create(const DoubleArrayOptions &options, io::Pool pool);
+  static DoubleArray *open(io::Pool pool, uint32_t block_id);
+
+  uint32_t block_id() const;
+
+  bool search(int64_t id, Slice *key);
+  bool search(const Slice &key, int64_t *id);
+
+  bool insert(const Slice &key, int64_t *id);
+
+  bool remove(int64_t id);
+  bool remove(const Slice &key);
+
+  bool update(int64_t id, const Slice &dest);
+  bool update(const Slice &src, const Slice &dest, int64_t *id);
+
+ private:
+  DoubleArray();
+};
+
+}  // namespace map
+}  // namespace grnxx
+
+#endif  // GRNXX_MAP_DOUBLE_ARRAY_HPP
-------------- next part --------------
HTML����������������������������...
Download 



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