0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️:vm: Add loghead convenience.

This commit is contained in:
Jason Volk 2019-03-21 12:49:02 -07:00
parent a6a509fe4b
commit 507c256eb4
2 changed files with 26 additions and 0 deletions

View file

@ -28,6 +28,9 @@ namespace ircd::m::vm
string_view reflect(const fault &);
http::code http_code(const fault &);
string_view loghead(const mutable_buffer &, const eval &);
string_view loghead(const eval &); // single tls buffer
}
namespace ircd::m::vm::sequence

View file

@ -1052,6 +1052,29 @@ decltype(ircd::m::vm::default_copts)
ircd::m::vm::default_copts
{};
ircd::string_view
ircd::m::vm::loghead(const eval &eval)
{
thread_local char buf[128];
return loghead(buf, eval);
}
ircd::string_view
ircd::m::vm::loghead(const mutable_buffer &buf,
const eval &eval)
{
return fmt::sprintf
{
buf, "vm[%lu:%lu:%lu] eval[%lu] id:%lu txn:%p",
sequence::uncommitted,
sequence::committed,
sequence::retired,
sequence::get(eval),
eval.id,
(const void *)txn
};
}
ircd::http::code
ircd::m::vm::http_code(const fault &code)
{