]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGTrim.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_MOSDPGTRIM_H
16 #define CEPH_MOSDPGTRIM_H
18 #include "msg/Message.h"
19 #include "messages/MOSDPeeringOp.h"
20 #include "osd/PGPeeringEvent.h"
22 class MOSDPGTrim final
: public MOSDPeeringOp
{
24 static constexpr int HEAD_VERSION
= 2;
25 static constexpr int COMPAT_VERSION
= 2;
32 epoch_t
get_epoch() const { return epoch
; }
33 spg_t
get_spg() const {
36 epoch_t
get_map_epoch() const {
39 epoch_t
get_min_epoch() const {
42 PGPeeringEvent
*get_event() override
{
43 return new PGPeeringEvent(
46 MTrim(epoch
, get_source().num(), pgid
.shard
, trim_to
));
49 MOSDPGTrim() : MOSDPeeringOp
{MSG_OSD_PG_TRIM
, HEAD_VERSION
, COMPAT_VERSION
} {}
50 MOSDPGTrim(version_t mv
, spg_t p
, eversion_t tt
) :
51 MOSDPeeringOp
{MSG_OSD_PG_TRIM
, HEAD_VERSION
, COMPAT_VERSION
},
52 epoch(mv
), pgid(p
), trim_to(tt
) { }
54 ~MOSDPGTrim() final
{}
57 std::string_view
get_type_name() const override
{ return "pg_trim"; }
58 void inner_print(std::ostream
& out
) const override
{
62 void encode_payload(uint64_t features
) override
{
64 encode(epoch
, payload
);
65 encode(pgid
.pgid
, payload
);
66 encode(trim_to
, payload
);
67 encode(pgid
.shard
, payload
);
69 void decode_payload() override
{
71 auto p
= payload
.cbegin();
75 decode(pgid
.shard
, p
);
78 template<class T
, typename
... Args
>
79 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);