13#include "common/lang/string.h"
14#include "common/lang/vector.h"
15#include "oblsm/include/ob_lsm_iterator.h"
16#include "oblsm/util/ob_comparator.h"
55 void add_offset(uint32_t offset) { offsets_.push_back(offset); }
57 uint32_t get_offset(
int index)
const {
return offsets_[index]; }
59 string_view get_entry(uint32_t offset)
const;
61 int size()
const {
return offsets_.size(); }
72 RC
decode(
const string &data);
78 vector<uint32_t> offsets_;
87 : comparator_(comparator), data_(data), count_(count)
94 void seek(
const string_view &lookup_key)
override;
106 bool valid()
const override {
return index_ < count_; }
114 string_view
key()
const override {
return key_; };
115 string_view
value()
const override {
return value_; }
123 string_view curr_entry_;
134 BlockMeta(
const string &first_key,
const string &last_key, uint32_t offset, uint32_t size)
135 : first_key_(first_key), last_key_(last_key), offset_(offset), size_(size)
137 string encode()
const;
138 RC decode(
const string &data);
Definition: ob_block.h:84
void seek_to_first() override
Positions the iterator at the first key-value pair in the source.
Definition: ob_block.h:95
void seek_to_last() override
Positions the iterator at the last key-value pair in the source.
Definition: ob_block.h:100
string_view value() const override
Returns the value of the current entry the iterator is positioned at.
Definition: ob_block.h:115
void next() override
Moves the iterator to the next key-value pair in the source.
Definition: ob_block.h:107
bool valid() const override
Checks if the iterator is currently positioned at a valid key-value pair.
Definition: ob_block.h:106
string_view key() const override
Returns the key of the current entry the iterator is positioned at.
Definition: ob_block.h:114
void seek(const string_view &lookup_key) override
Positions the iterator at the first entry with a key greater than or equal to the specified key.
Definition: ob_block.cpp:71
Represents a data block in the LSM-Tree.
Definition: ob_block.h:50
RC decode(const string &data)
Decodes serialized block data.
Definition: ob_block.cpp:17
base class of all comparators
Definition: ob_comparator.h:21
Abstract class for iterating over key-value pairs in an LSM-Tree.
Definition: ob_lsm_iterator.h:41