#pragma once
#include "rocksdb/table_properties.h"
#include <memory>
#include <string>
#include <vector>
namespace
rocksdb {
struct
InternalKeyTablePropertiesNames {
static
const
std::string kDeletedKeys;
};
class
InternalKeyPropertiesCollector :
public
TablePropertiesCollector {
public
:
virtual
Status Add(
const
Slice& key,
const
Slice& value) override;
virtual
Status Finish(
TableProperties::UserCollectedProperties* properties) override;
virtual
const
char
* Name()
const
override {
return
"InternalKeyPropertiesCollector"
;
}
TableProperties::UserCollectedProperties
GetReadableProperties()
const
override;
private
:
uint64_t deleted_keys_ = 0;
};
class
UserKeyTablePropertiesCollector :
public
TablePropertiesCollector {
public
:
explicit
UserKeyTablePropertiesCollector(
TablePropertiesCollector* collector) :
UserKeyTablePropertiesCollector(
std::shared_ptr<TablePropertiesCollector>(collector)
) {
}
explicit
UserKeyTablePropertiesCollector(
std::shared_ptr<TablePropertiesCollector> collector) :
collector_(collector) {
}
virtual
~UserKeyTablePropertiesCollector() { }
virtual
Status Add(
const
Slice& key,
const
Slice& value) override;
virtual
Status Finish(
TableProperties::UserCollectedProperties* properties) override;
virtual
const
char
* Name()
const
override {
return
collector_->Name(); }
TableProperties::UserCollectedProperties
GetReadableProperties()
const
override;
protected
:
std::shared_ptr<TablePropertiesCollector> collector_;
};
}