mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd::db: Add compression string option to column descriptor.
This commit is contained in:
parent
8311c1e7ff
commit
25e6cd1332
3 changed files with 30 additions and 2 deletions
|
@ -75,6 +75,11 @@ struct ircd::db::descriptor
|
|||
/// the cache.
|
||||
size_t meta_block_size { 512 };
|
||||
|
||||
/// 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 {"kSnappyCompression;kLZ4Compression"};
|
||||
|
||||
/// User given compaction callback surface.
|
||||
db::compactor compactor {};
|
||||
};
|
||||
|
|
26
ircd/db.cc
26
ircd/db.cc
|
@ -1627,8 +1627,7 @@ ircd::db::database::column::column(database &d,
|
|||
this->options.optimize_filters_for_hits = this->descriptor->expect_queries_hit;
|
||||
|
||||
// Compression
|
||||
//TODO: descriptor / conf / detect etc...
|
||||
this->options.compression = rocksdb::kSnappyCompression;
|
||||
this->options.compression = find_supported_compression(this->descriptor->compression);
|
||||
//this->options.compression = rocksdb::kNoCompression;
|
||||
|
||||
//TODO: descriptor / conf
|
||||
|
@ -9603,6 +9602,29 @@ const
|
|||
// Misc
|
||||
//
|
||||
|
||||
rocksdb::CompressionType
|
||||
ircd::db::find_supported_compression(const std::string &list)
|
||||
{
|
||||
rocksdb::CompressionType ret
|
||||
{
|
||||
rocksdb::kNoCompression
|
||||
};
|
||||
|
||||
tokens(list, ';', [&ret]
|
||||
(const string_view &name)
|
||||
{
|
||||
for(size_t i(0); i < db::compressions.size(); ++i)
|
||||
if(!db::compressions.at(i).empty())
|
||||
if(name == db::compressions.at(i))
|
||||
{
|
||||
ret = rocksdb::CompressionType(i);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
rocksdb::DBOptions
|
||||
ircd::db::make_dbopts(std::string optstr,
|
||||
std::string *const &out,
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace ircd::db
|
|||
// Database options creator
|
||||
bool optstr_find_and_remove(std::string &optstr, const std::string &what);
|
||||
rocksdb::DBOptions make_dbopts(std::string optstr, std::string *const &out = nullptr, bool *read_only = nullptr, bool *fsck = nullptr);
|
||||
rocksdb::CompressionType find_supported_compression(const std::string &);
|
||||
|
||||
// Validation functors
|
||||
bool valid(const rocksdb::Iterator &);
|
||||
|
|
Loading…
Reference in a new issue