]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGScan.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_MOSDPGSCAN_H
16 #define CEPH_MOSDPGSCAN_H
18 #include "MOSDFastDispatchOp.h"
20 class MOSDPGScan final
: public MOSDFastDispatchOp
{
22 static constexpr int HEAD_VERSION
= 2;
23 static constexpr int COMPAT_VERSION
= 2;
27 OP_SCAN_GET_DIGEST
= 1, // just objects and versions
28 OP_SCAN_DIGEST
= 2, // result
30 const char *get_op_name(int o
) const {
32 case OP_SCAN_GET_DIGEST
: return "get_digest";
33 case OP_SCAN_DIGEST
: return "digest";
34 default: return "???";
39 epoch_t map_epoch
= 0, query_epoch
= 0;
44 epoch_t
get_map_epoch() const override
{
47 epoch_t
get_min_epoch() const override
{
50 spg_t
get_spg() const override
{
54 void decode_payload() override
{
56 auto p
= payload
.cbegin();
59 decode(query_epoch
, p
);
64 // handle hobject_t format upgrade
65 if (!begin
.is_max() && begin
.pool
== -1)
66 begin
.pool
= pgid
.pool();
67 if (!end
.is_max() && end
.pool
== -1)
68 end
.pool
= pgid
.pool();
71 decode(pgid
.shard
, p
);
74 void encode_payload(uint64_t features
) override
{
77 encode(map_epoch
, payload
);
78 assert(HAVE_FEATURE(features
, SERVER_NAUTILUS
));
79 encode(query_epoch
, payload
);
80 encode(pgid
.pgid
, payload
);
81 encode(begin
, payload
);
83 encode(from
, payload
);
84 encode(pgid
.shard
, payload
);
88 : MOSDFastDispatchOp
{MSG_OSD_PG_SCAN
, HEAD_VERSION
, COMPAT_VERSION
} {}
89 MOSDPGScan(__u32 o
, pg_shard_t from
,
90 epoch_t e
, epoch_t qe
, spg_t p
, hobject_t be
, hobject_t en
)
91 : MOSDFastDispatchOp
{MSG_OSD_PG_SCAN
, HEAD_VERSION
, COMPAT_VERSION
},
93 map_epoch(e
), query_epoch(qe
),
99 ~MOSDPGScan() final
{}
102 std::string_view
get_type_name() const override
{ return "pg_scan"; }
103 void print(std::ostream
& out
) const override
{
104 out
<< "pg_scan(" << get_op_name(op
)
106 << " " << begin
<< "-" << end
107 << " e " << map_epoch
<< "/" << query_epoch
111 template<class T
, typename
... Args
>
112 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);