]>
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
: public MOSDFastDispatchOp
{
22 static const int HEAD_VERSION
= 2;
23 static const 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
{
55 bufferlist::iterator p
= payload
.begin();
57 ::decode(map_epoch
, p
);
58 ::decode(query_epoch
, p
);
59 ::decode(pgid
.pgid
, p
);
63 // handle hobject_t format upgrade
64 if (!begin
.is_max() && begin
.pool
== -1)
65 begin
.pool
= pgid
.pool();
66 if (!end
.is_max() && end
.pool
== -1)
67 end
.pool
= pgid
.pool();
70 ::decode(pgid
.shard
, p
);
73 void encode_payload(uint64_t features
) override
{
74 ::encode(op
, payload
);
75 ::encode(map_epoch
, payload
);
76 ::encode(query_epoch
, payload
);
77 ::encode(pgid
.pgid
, payload
);
78 ::encode(begin
, payload
);
79 ::encode(end
, payload
);
80 ::encode(from
, payload
);
81 ::encode(pgid
.shard
, payload
);
85 : MOSDFastDispatchOp(MSG_OSD_PG_SCAN
, HEAD_VERSION
, COMPAT_VERSION
) {}
86 MOSDPGScan(__u32 o
, pg_shard_t from
,
87 epoch_t e
, epoch_t qe
, spg_t p
, hobject_t be
, hobject_t en
)
88 : MOSDFastDispatchOp(MSG_OSD_PG_SCAN
, HEAD_VERSION
, COMPAT_VERSION
),
90 map_epoch(e
), query_epoch(e
),
96 ~MOSDPGScan() override
{}
99 const char *get_type_name() const override
{ return "pg_scan"; }
100 void print(ostream
& out
) const override
{
101 out
<< "pg_scan(" << get_op_name(op
)
103 << " " << begin
<< "-" << end
104 << " e " << map_epoch
<< "/" << query_epoch