0
0
Fork 0
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:
Jason Volk 2020-01-08 11:23:47 -08:00
parent a90b4e1344
commit ffcc49b9e5
2 changed files with 41 additions and 0 deletions

View file

@ -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 & = {});

View file

@ -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)
{