mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
ircd::db: Use conf item for default compression string in descriptor.
This commit is contained in:
parent
4168f2899f
commit
e2ac5c6fc7
12 changed files with 33 additions and 13 deletions
|
@ -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 {};
|
||||
|
|
21
ircd/db.cc
21
ircd/db.cc
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ ircd::m::dbs::desc::event_horizon
|
|||
size_t(event_horizon__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -118,7 +118,7 @@ ircd::m::dbs::desc::event_idx
|
|||
size_t(event_idx__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -107,7 +107,7 @@ ircd::m::dbs::desc::event_json
|
|||
size_t(event_json__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -142,7 +142,7 @@ ircd::m::dbs::desc::event_sender
|
|||
size_t(event_sender__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -116,7 +116,7 @@ ircd::m::dbs::desc::event_state
|
|||
size_t(event_state__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -119,7 +119,7 @@ ircd::m::dbs::desc::event_type
|
|||
size_t(event_type__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -125,7 +125,7 @@ ircd::m::dbs::desc::room_joined
|
|||
size_t(room_joined__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -134,7 +134,7 @@ ircd::m::dbs::desc::room_state
|
|||
size_t(room_state__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
|
@ -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
|
||||
{},
|
||||
|
|
|
@ -142,7 +142,7 @@ ircd::m::dbs::desc::room_type
|
|||
size_t(room_type__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
"default"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
|
Loading…
Reference in a new issue