]>
git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGPush.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) 2013 Inktank Storage, Inc.
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.
18 #include "MOSDFastDispatchOp.h"
20 class MOSDPGPush
: public MOSDFastDispatchOp
{
22 static constexpr int HEAD_VERSION
= 4;
23 static constexpr int COMPAT_VERSION
= 2;
28 epoch_t map_epoch
= 0, min_epoch
= 0;
29 std::vector
<PushOp
> pushes
;
30 bool is_repair
= false;
36 void compute_cost(CephContext
*cct
) {
38 for (auto i
= pushes
.begin(); i
!= pushes
.end(); ++i
) {
43 int get_cost() const override
{
47 epoch_t
get_map_epoch() const override
{
50 epoch_t
get_min_epoch() const override
{
53 spg_t
get_spg() const override
{
57 void set_cost(uint64_t c
) {
62 : MOSDFastDispatchOp
{MSG_OSD_PG_PUSH
, HEAD_VERSION
, COMPAT_VERSION
}
65 void decode_payload() override
{
67 auto p
= payload
.cbegin();
72 decode(pgid
.shard
, p
);
74 if (header
.version
>= 3) {
77 min_epoch
= map_epoch
;
79 if (header
.version
>= 4) {
86 void encode_payload(uint64_t features
) override
{
88 encode(pgid
.pgid
, payload
);
89 encode(map_epoch
, payload
);
90 encode(pushes
, payload
, features
);
91 encode(cost
, payload
);
92 encode(pgid
.shard
, payload
);
93 encode(from
, payload
);
94 encode(min_epoch
, payload
);
95 encode(is_repair
, payload
);
98 std::string_view
get_type_name() const override
{ return "MOSDPGPush"; }
100 void print(std::ostream
& out
) const override
{
101 out
<< "MOSDPGPush(" << pgid
102 << " " << map_epoch
<< "/" << min_epoch
108 template<class T
, typename
... Args
>
109 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);