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

#include <format.h>

Public Types

enum  { kMaxEncodedLength = 10 + 10 }
 

Public Member Functions

 BlockHandle ()
 
uint64_t offset () const
 
void set_offset (uint64_t offset)
 
uint64_t size () const
 
void set_size (uint64_t size)
 
void EncodeTo (std::string *dst) const
 
Status DecodeFrom (Slice *input)
 

Private Attributes

uint64_t offset_
 
uint64_t size_
 

Detailed Description

Definition at line 22 of file format.h.

Member Enumeration Documentation

§ anonymous enum

anonymous enum
Enumerator
kMaxEncodedLength 

Definition at line 38 of file format.h.

Constructor & Destructor Documentation

§ BlockHandle()

leveldb::BlockHandle::BlockHandle ( )
inline

Definition at line 101 of file format.h.

102  : offset_(~static_cast<uint64_t>(0)),
103  size_(~static_cast<uint64_t>(0)) {
104 }
uint64_t size_
Definition: format.h:42
uint64_t offset_
Definition: format.h:41

Member Function Documentation

§ DecodeFrom()

Status leveldb::BlockHandle::DecodeFrom ( Slice input)

Definition at line 23 of file format.cc.

23  {
24  if (GetVarint64(input, &offset_) &&
25  GetVarint64(input, &size_)) {
26  return Status::OK();
27  } else {
28  return Status::Corruption("bad block handle");
29  }
30 }
static Status Corruption(const Slice &msg, const Slice &msg2=Slice())
Definition: status.h:38
uint64_t size_
Definition: format.h:42
static Status OK()
Definition: status.h:32
uint64_t offset_
Definition: format.h:41
bool GetVarint64(Slice *input, uint64_t *value)
Definition: coding.cc:160
Here is the call graph for this function:
Here is the caller graph for this function:

§ EncodeTo()

void leveldb::BlockHandle::EncodeTo ( std::string *  dst) const

Definition at line 15 of file format.cc.

15  {
16  // Sanity check that all fields have been set
17  assert(offset_ != ~static_cast<uint64_t>(0));
18  assert(size_ != ~static_cast<uint64_t>(0));
19  PutVarint64(dst, offset_);
20  PutVarint64(dst, size_);
21 }
void PutVarint64(std::string *dst, uint64_t v)
Definition: coding.cc:92
uint64_t size_
Definition: format.h:42
uint64_t offset_
Definition: format.h:41
Here is the call graph for this function:
Here is the caller graph for this function:

§ offset()

uint64_t leveldb::BlockHandle::offset ( ) const
inline

Definition at line 27 of file format.h.

27 { return offset_; }
uint64_t offset_
Definition: format.h:41
Here is the caller graph for this function:

§ set_offset()

void leveldb::BlockHandle::set_offset ( uint64_t  offset)
inline

Definition at line 28 of file format.h.

28 { offset_ = offset; }
uint64_t offset_
Definition: format.h:41
uint64_t offset() const
Definition: format.h:27
Here is the call graph for this function:
Here is the caller graph for this function:

§ set_size()

void leveldb::BlockHandle::set_size ( uint64_t  size)
inline

Definition at line 32 of file format.h.

32 { size_ = size; }
uint64_t size() const
Definition: format.h:31
uint64_t size_
Definition: format.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

§ size()

uint64_t leveldb::BlockHandle::size ( ) const
inline

Definition at line 31 of file format.h.

31 { return size_; }
uint64_t size_
Definition: format.h:42
Here is the caller graph for this function:

Member Data Documentation

§ offset_

uint64_t leveldb::BlockHandle::offset_
private

Definition at line 41 of file format.h.

§ size_

uint64_t leveldb::BlockHandle::size_
private

Definition at line 42 of file format.h.


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