leveldb
Public Member Functions | Private Member Functions | Private Attributes | List of all members
leveldb::LookupKey Class Reference

#include <dbformat.h>

Public Member Functions

 LookupKey (const Slice &user_key, SequenceNumber sequence)
 
 ~LookupKey ()
 
Slice memtable_key () const
 
Slice internal_key () const
 
Slice user_key () const
 

Private Member Functions

 LookupKey (const LookupKey &)
 
void operator= (const LookupKey &)
 

Private Attributes

const char * start_
 
const char * kstart_
 
const char * end_
 
char space_ [200]
 

Detailed Description

Definition at line 189 of file dbformat.h.

Constructor & Destructor Documentation

§ LookupKey() [1/2]

leveldb::LookupKey::LookupKey ( const Slice user_key,
SequenceNumber  sequence 
)

Definition at line 121 of file dbformat.cc.

121  {
122  size_t usize = user_key.size();
123  size_t needed = usize + 13; // A conservative estimate
124  char* dst;
125  if (needed <= sizeof(space_)) {
126  dst = space_;
127  } else {
128  dst = new char[needed];
129  }
130  start_ = dst;
131  dst = EncodeVarint32(dst, usize + 8);
132  kstart_ = dst;
133  memcpy(dst, user_key.data(), usize);
134  dst += usize;
136  dst += 8;
137  end_ = dst;
138 }
const char * end_
Definition: dbformat.h:216
Slice user_key() const
Definition: dbformat.h:204
char * EncodeVarint32(char *dst, uint32_t v)
Definition: coding.cc:47
char space_[200]
Definition: dbformat.h:217
void EncodeFixed64(char *buf, uint64_t value)
Definition: coding.cc:20
static const ValueType kValueTypeForSeek
Definition: dbformat.h:61
const char * kstart_
Definition: dbformat.h:215
const char * start_
Definition: dbformat.h:214
const char * data() const
Definition: slice.h:40
size_t size() const
Definition: slice.h:43
static uint64_t PackSequenceAndType(uint64_t seq, ValueType t)
Definition: dbformat.cc:12
Here is the call graph for this function:

§ ~LookupKey()

leveldb::LookupKey::~LookupKey ( )
inline

Definition at line 224 of file dbformat.h.

224  {
225  if (start_ != space_) delete[] start_;
226 }
char space_[200]
Definition: dbformat.h:217
const char * start_
Definition: dbformat.h:214

§ LookupKey() [2/2]

leveldb::LookupKey::LookupKey ( const LookupKey )
private

Member Function Documentation

§ internal_key()

Slice leveldb::LookupKey::internal_key ( ) const
inline

Definition at line 201 of file dbformat.h.

201 { return Slice(kstart_, end_ - kstart_); }
const char * end_
Definition: dbformat.h:216
const char * kstart_
Definition: dbformat.h:215
Here is the caller graph for this function:

§ memtable_key()

Slice leveldb::LookupKey::memtable_key ( ) const
inline

Definition at line 198 of file dbformat.h.

198 { return Slice(start_, end_ - start_); }
const char * end_
Definition: dbformat.h:216
const char * start_
Definition: dbformat.h:214
Here is the caller graph for this function:

§ operator=()

void leveldb::LookupKey::operator= ( const LookupKey )
private

§ user_key()

Slice leveldb::LookupKey::user_key ( ) const
inline

Definition at line 204 of file dbformat.h.

204 { return Slice(kstart_, end_ - kstart_ - 8); }
const char * end_
Definition: dbformat.h:216
const char * kstart_
Definition: dbformat.h:215
Here is the caller graph for this function:

Member Data Documentation

§ end_

const char* leveldb::LookupKey::end_
private

Definition at line 216 of file dbformat.h.

§ kstart_

const char* leveldb::LookupKey::kstart_
private

Definition at line 215 of file dbformat.h.

§ space_

char leveldb::LookupKey::space_[200]
private

Definition at line 217 of file dbformat.h.

§ start_

const char* leveldb::LookupKey::start_
private

Definition at line 214 of file dbformat.h.


The documentation for this class was generated from the following files: