#pragma once #include #include #include "leveldb/slice.h" #include "util/serialize_value.h" namespace fielddb { using namespace leveldb; /*根据写入的流程可以推断,需要存在metaDB中的数据其实都是带索引的数据,也就是FieldArray*/ class MetaKV { MetaKV(Slice &Key,FieldArray Fields): Key(Key),Fields(Fields),tag(0),meta_seq(0) { } inline int get_seq() { return meta_seq; } inline void set_seq(int meta_seq) { this->meta_seq = meta_seq; } inline void setPut() { tag = PUT; } inline void setDelete() { tag = DELETE; } Slice metaKey(); Slice metaValue(); private: enum {PUT = 0x0,DELETE = 0x1}; uint64_t meta_seq; uint8_t tag; Slice &Key; FieldArray Fields; }; }