crimson/osd, osd: define fmt's formatter for ObjectState

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
Radoslaw Zarzynski 2023-04-27 17:54:41 +00:00
parent 8b0eb9f5bb
commit cfb7a9c734
2 changed files with 25 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include "crimson/osd/osd_operation_external_tracking.h"
#include "crimson/osd/osd_operations/client_request.h"
#include "crimson/osd/osd_connection_priv.h"
#include "osd/object_state_fmt.h"
namespace {
seastar::logger& logger() {
@ -231,7 +232,7 @@ ClientRequest::process_op(instance_handle_t &ihref, Ref<PG> &pg)
return pg->with_locked_obc(
m->get_hobj(), op_info,
[this, pg, &ihref](auto obc) mutable {
logger().debug("{}: got obc {}", *this, obc->obs.exists);
logger().debug("{}: got obc {}", *this, obc->obs);
return ihref.enter_stage<interruptor>(
pp(*pg).process, *this
).then_interruptible([this, pg, obc, &ihref]() mutable {

View File

@ -0,0 +1,23 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#pragma once
/**
* \file fmtlib formatters for some types.h classes
*/
#include "osd/object_state.h"
#include "osd/osd_types_fmt.h"
#if FMT_VERSION >= 90000
#include <fmt/ostream.h>
#endif
template <>
struct fmt::formatter<ObjectState> {
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
template <typename FormatContext>
auto format(const ObjectState& os, FormatContext& ctx) const
{
return fmt::format_to(ctx.out(), "exists {} oi {}", os.exists, os.oi);
}
};