mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 07:20:55 +01:00
ircd::db: Add interface to checksum per file.
This commit is contained in:
parent
a90b4e1344
commit
ffcc49b9e5
2 changed files with 41 additions and 0 deletions
|
@ -52,6 +52,7 @@ namespace ircd::db
|
|||
void bgcontinue(database &);
|
||||
void bgpause(database &);
|
||||
void resume(database &);
|
||||
void check(database &, const string_view &file);
|
||||
void check(database &);
|
||||
void compact(database &, const std::pair<int, int> &level, const compactor & = {});
|
||||
void compact(database &, const compactor & = {});
|
||||
|
|
40
ircd/db.cc
40
ircd/db.cc
|
@ -472,6 +472,46 @@ ircd::db::check(database &d)
|
|||
};
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::check(database &d,
|
||||
const string_view &file)
|
||||
{
|
||||
assert(file);
|
||||
assert(d.d);
|
||||
|
||||
const auto &opts
|
||||
{
|
||||
d.d->GetOptions()
|
||||
};
|
||||
|
||||
const rocksdb::EnvOptions env_opts
|
||||
{
|
||||
opts
|
||||
};
|
||||
|
||||
const bool absolute
|
||||
{
|
||||
fs::is_absolute(file)
|
||||
};
|
||||
|
||||
const string_view parts[]
|
||||
{
|
||||
d.path, file
|
||||
};
|
||||
|
||||
const std::string path
|
||||
{
|
||||
!absolute?
|
||||
fs::path_string(parts):
|
||||
std::string{file}
|
||||
};
|
||||
|
||||
throw_on_error
|
||||
{
|
||||
rocksdb::VerifySstFileChecksum(opts, env_opts, path)
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
ircd::db::resume(database &d)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue