mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
ircd::db: Add valid(rocksdb::Status) to suite.
This commit is contained in:
parent
61d0165883
commit
8b7fe333ec
2 changed files with 21 additions and 0 deletions
20
ircd/db.cc
20
ircd/db.cc
|
@ -8078,6 +8078,26 @@ ircd::db::valid(const rocksdb::Iterator &it)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::db::valid(const rocksdb::Status &s)
|
||||
{
|
||||
switch(s.code())
|
||||
{
|
||||
using rocksdb::Status;
|
||||
|
||||
case Status::kOk:
|
||||
return true;
|
||||
|
||||
case Status::kNotFound:
|
||||
case Status::kIncomplete:
|
||||
return false;
|
||||
|
||||
default:
|
||||
throw_on_error{s};
|
||||
__builtin_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// column_names
|
||||
//
|
||||
|
|
|
@ -102,6 +102,7 @@ namespace ircd::db
|
|||
std::vector<std::string> column_names(const std::string &path, const std::string &options);
|
||||
|
||||
// Validation functors
|
||||
bool valid(const rocksdb::Status &);
|
||||
bool valid(const rocksdb::Iterator &);
|
||||
bool operator!(const rocksdb::Iterator &);
|
||||
using valid_proffer = std::function<bool (const rocksdb::Iterator &)>;
|
||||
|
|
Loading…
Reference in a new issue