mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd::db: Add and use reflection for Status::Severity.
This commit is contained in:
parent
ac01ae0936
commit
5da7f20a9a
2 changed files with 21 additions and 1 deletions
21
ircd/db.cc
21
ircd/db.cc
|
@ -2348,8 +2348,9 @@ noexcept
|
||||||
assert(status);
|
assert(status);
|
||||||
log::error
|
log::error
|
||||||
{
|
{
|
||||||
rog, "'%s' background error in %s :%s",
|
rog, "'%s' background %s error in %s :%s",
|
||||||
d->name,
|
d->name,
|
||||||
|
reflect(status->severity()),
|
||||||
reflect(reason),
|
reflect(reason),
|
||||||
status->ToString()
|
status->ToString()
|
||||||
};
|
};
|
||||||
|
@ -9895,6 +9896,24 @@ ircd::db::reflect(const rocksdb::Env::IOPriority &p)
|
||||||
return "IO_????"_sv;
|
return "IO_????"_sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ircd::string_view
|
||||||
|
ircd::db::reflect(const rocksdb::Status::Severity &s)
|
||||||
|
{
|
||||||
|
using Severity = rocksdb::Status::Severity;
|
||||||
|
|
||||||
|
switch(s)
|
||||||
|
{
|
||||||
|
case Severity::kNoError: return "NONE";
|
||||||
|
case Severity::kSoftError: return "SOFT";
|
||||||
|
case Severity::kHardError: return "HARD";
|
||||||
|
case Severity::kFatalError: return "FATAL";
|
||||||
|
case Severity::kUnrecoverableError: return "UNRECOVERABLE";
|
||||||
|
case Severity::kMaxSeverity: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "?????";
|
||||||
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::string_view
|
||||||
ircd::db::reflect(const rocksdb::RandomAccessFile::AccessPattern &p)
|
ircd::db::reflect(const rocksdb::RandomAccessFile::AccessPattern &p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace ircd::db
|
||||||
extern ctx::mutex write_mutex;
|
extern ctx::mutex write_mutex;
|
||||||
|
|
||||||
// reflections
|
// reflections
|
||||||
|
string_view reflect(const rocksdb::Status::Severity &);
|
||||||
string_view reflect(const rocksdb::Env::Priority &p);
|
string_view reflect(const rocksdb::Env::Priority &p);
|
||||||
string_view reflect(const rocksdb::Env::IOPriority &p);
|
string_view reflect(const rocksdb::Env::IOPriority &p);
|
||||||
string_view reflect(const rocksdb::WriteStallCondition &);
|
string_view reflect(const rocksdb::WriteStallCondition &);
|
||||||
|
|
Loading…
Reference in a new issue