2018-09-21 00:57:15 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
2018-09-22 22:13:05 +02:00
|
|
|
#define HAVE_IRCD_DB_DATABASE_SST_H
|
2018-09-21 00:57:15 +02:00
|
|
|
|
2018-09-22 22:13:05 +02:00
|
|
|
struct ircd::db::database::sst
|
2018-09-22 02:12:50 +02:00
|
|
|
{
|
2018-09-22 22:13:05 +02:00
|
|
|
struct info;
|
2018-09-22 23:24:15 +02:00
|
|
|
struct dump;
|
2021-11-18 02:07:24 +01:00
|
|
|
struct scan;
|
2018-09-22 02:12:50 +02:00
|
|
|
|
2021-11-18 00:19:12 +01:00
|
|
|
[[deprecated]]
|
2018-09-22 23:24:15 +02:00
|
|
|
static void tool(const vector_view<const string_view> &args);
|
2018-09-22 22:13:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Get info about an SST file.
|
|
|
|
///
|
|
|
|
struct ircd::db::database::sst::info
|
2018-09-21 00:57:15 +02:00
|
|
|
{
|
|
|
|
struct vector;
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
std::string path;
|
|
|
|
std::string column;
|
2018-10-21 18:15:44 +02:00
|
|
|
std::string filter;
|
|
|
|
std::string comparator;
|
|
|
|
std::string merge_operator;
|
|
|
|
std::string prefix_extractor;
|
|
|
|
std::string compression;
|
2020-08-06 06:32:29 +02:00
|
|
|
std::string checksum;
|
|
|
|
std::string checksum_func;
|
2020-10-14 00:28:55 +02:00
|
|
|
uint64_t id {0};
|
2018-10-21 18:15:44 +02:00
|
|
|
uint64_t format {0};
|
|
|
|
uint64_t cfid {0};
|
|
|
|
uint64_t size {0};
|
2020-09-29 16:12:41 +02:00
|
|
|
uint64_t head_size {0}; // index_size + filter_size
|
2018-10-21 18:15:44 +02:00
|
|
|
uint64_t data_size {0};
|
2020-09-29 16:12:41 +02:00
|
|
|
uint64_t file_size {0}; // head_size + data_size
|
2020-10-01 01:24:15 +02:00
|
|
|
uint64_t meta_size {0}; // size - data_size (???)
|
2020-09-29 16:12:41 +02:00
|
|
|
uint64_t index_root_size {0};
|
|
|
|
uint64_t index_data_size {0};
|
|
|
|
uint64_t index_size {0}; // index_root_size + index_data_size
|
2018-10-21 18:15:44 +02:00
|
|
|
uint64_t filter_size {0};
|
|
|
|
uint64_t keys_size {0};
|
|
|
|
uint64_t values_size {0};
|
2020-09-29 16:12:41 +02:00
|
|
|
uint64_t blocks_size {0}; // keys_size + values_size
|
2018-10-21 18:15:44 +02:00
|
|
|
uint64_t index_parts {0};
|
|
|
|
uint64_t data_blocks {0};
|
|
|
|
uint64_t entries {0};
|
|
|
|
uint64_t range_deletes {0};
|
|
|
|
uint64_t fixed_key_len {0};
|
2018-09-21 00:57:15 +02:00
|
|
|
uint64_t min_seq {0};
|
|
|
|
uint64_t max_seq {0};
|
|
|
|
std::string min_key;
|
|
|
|
std::string max_key;
|
|
|
|
uint64_t num_reads {0};
|
|
|
|
int level {-1};
|
|
|
|
bool compacting {false};
|
2018-09-22 23:24:15 +02:00
|
|
|
int32_t version {-1};
|
2018-10-21 18:15:44 +02:00
|
|
|
time_t created {0};
|
|
|
|
time_t oldest_key {0};
|
2020-06-10 05:37:30 +02:00
|
|
|
bool delta_encoding {false};
|
2020-09-29 16:12:41 +02:00
|
|
|
float compression_pct {0.0};
|
2020-10-01 01:24:15 +02:00
|
|
|
float index_compression_pct {0.0};
|
|
|
|
float blocks_compression_pct {0.0};
|
2018-09-21 00:57:15 +02:00
|
|
|
|
2018-09-22 22:13:05 +02:00
|
|
|
info(const database &, const string_view &filename);
|
2018-10-21 17:08:12 +02:00
|
|
|
info() = default;
|
|
|
|
|
|
|
|
info &operator=(rocksdb::SstFileMetaData &&);
|
|
|
|
info &operator=(rocksdb::LiveFileMetaData &&);
|
2018-10-21 18:15:44 +02:00
|
|
|
info &operator=(rocksdb::TableProperties &&);
|
2018-09-21 00:57:15 +02:00
|
|
|
};
|
|
|
|
|
2018-09-22 22:13:05 +02:00
|
|
|
struct ircd::db::database::sst::info::vector
|
|
|
|
:std::vector<info>
|
2018-09-21 00:57:15 +02:00
|
|
|
{
|
|
|
|
vector() = default;
|
|
|
|
explicit vector(const database &);
|
2018-09-25 07:26:44 +02:00
|
|
|
explicit vector(const db::column &);
|
2018-09-21 00:57:15 +02:00
|
|
|
};
|
2018-09-22 23:24:15 +02:00
|
|
|
|
|
|
|
struct ircd::db::database::sst::dump
|
|
|
|
{
|
|
|
|
using key_range = std::pair<string_view, string_view>;
|
|
|
|
|
|
|
|
sst::info info;
|
|
|
|
|
|
|
|
dump(db::column, const key_range & = {}, const string_view &path = {});
|
|
|
|
dump(dump &&) = delete;
|
|
|
|
dump(const dump &) = delete;
|
|
|
|
};
|
2021-11-18 02:07:24 +01:00
|
|
|
|
|
|
|
struct ircd::db::database::sst::scan
|
|
|
|
{
|
|
|
|
using closure = std::function<bool (const string_view &, const string_view &)>;
|
|
|
|
|
|
|
|
scan(db::database &, const string_view &path, const closure &);
|
|
|
|
scan(db::database &, const string_view &path); // VerifyChecksum
|
|
|
|
};
|