From cd0c2bb55705e15cad6209db49090ca71fdbe7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BA=88=E6=9B=88?= <10222140454@stu.ecnu.edu.cn> Date: Sun, 5 Jan 2025 21:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=AD=97=E6=AE=B5-Put=5Ffields,Get=5F?= =?UTF-8?q?fields,FindKeysByField?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/leveldb/db.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/leveldb/db.h b/include/leveldb/db.h index cb74cda..81303b8 100644 --- a/include/leveldb/db.h +++ b/include/leveldb/db.h @@ -7,6 +7,7 @@ #include #include +#include #include "leveldb/export.h" #include "leveldb/iterator.h" @@ -14,6 +15,9 @@ namespace leveldb { +using Field = std::pair; +using FieldArray = std::vector>; + // Update CMakeLists.txt if you change these static const int kMajorVersion = 1; static const int kMinorVersion = 23; @@ -87,6 +91,14 @@ class LEVELDB_EXPORT DB { virtual Status Get(const ReadOptions& options, const Slice& key, std::string* value) = 0; + virtual Status Put_fields(const WriteOptions& options, const Slice& key, + const FieldArray& fields) = 0; + + virtual Status Get_fields(const ReadOptions& options, const Slice& key, + FieldArray* fields) = 0; + + virtual std::vector FindKeysByField(leveldb::DB* db, Field &field) = 0; + // Return a heap-allocated iterator over the contents of the database. // The result of NewIterator() is initially invalid (caller must // call one of the Seek methods on the iterator before using it).