0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-29 17:04:03 +01:00

ircd::db: Use conf item for default compression string in descriptor.

This commit is contained in:
Jason Volk 2020-09-20 12:43:26 -07:00
parent 4168f2899f
commit e2ac5c6fc7
12 changed files with 33 additions and 13 deletions

View file

@ -84,8 +84,9 @@ struct ircd::db::descriptor
/// Compression algorithm for this column. Empty string is equal to
/// kNoCompression. List is semicolon separated to allow fallbacks in
/// case the first algorithms are not supported.
std::string compression {"kLZ4Compression;kSnappyCompression"};
/// case the first algorithms are not supported. "default" will be
// replaced by the string in the ircd.db.compression.default conf item.
std::string compression {"default"};
/// User given compaction callback surface.
db::compactor compactor {};

View file

@ -8947,14 +8947,33 @@ catch(const not_found &)
// Misc
//
namespace ircd::db
{
extern conf::item<std::string> compression_default;
}
decltype(ircd::db::compression_default)
ircd::db::compression_default
{
{ "name", "ircd.db.compression.default" },
{ "default", "kLZ4Compression;kSnappyCompression" },
};
rocksdb::CompressionType
ircd::db::find_supported_compression(const std::string &list)
ircd::db::find_supported_compression(const std::string &input)
{
rocksdb::CompressionType ret
{
rocksdb::kNoCompression
};
const auto &list
{
input == "default"?
string_view{compression_default}:
string_view{input}
};
tokens(list, ';', [&ret]
(const string_view &requested)
{

View file

@ -130,7 +130,7 @@ ircd::m::dbs::desc::event_horizon
size_t(event_horizon__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -118,7 +118,7 @@ ircd::m::dbs::desc::event_idx
size_t(event_idx__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -107,7 +107,7 @@ ircd::m::dbs::desc::event_json
size_t(event_json__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -142,7 +142,7 @@ ircd::m::dbs::desc::event_sender
size_t(event_sender__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -116,7 +116,7 @@ ircd::m::dbs::desc::event_state
size_t(event_state__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -119,7 +119,7 @@ ircd::m::dbs::desc::event_type
size_t(event_type__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -125,7 +125,7 @@ ircd::m::dbs::desc::room_joined
size_t(room_joined__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -134,7 +134,7 @@ ircd::m::dbs::desc::room_state
size_t(room_state__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -134,7 +134,7 @@ ircd::m::dbs::desc::room_state_space
size_t(room_state_space__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},

View file

@ -142,7 +142,7 @@ ircd::m::dbs::desc::room_type
size_t(room_type__meta_block__size),
// compression
"kLZ4Compression;kSnappyCompression"s,
"default"s,
// compactor
{},