]>
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 MessageInstance
<MOSDPGPush
, MOSDFastDispatchOp
> {
24 static constexpr int HEAD_VERSION
= 4;
25 static constexpr int COMPAT_VERSION
= 2;
30 epoch_t map_epoch
= 0, min_epoch
= 0;
31 vector
<PushOp
> pushes
;
32 bool is_repair
= false;
38 void compute_cost(CephContext
*cct
) {
40 for (vector
<PushOp
>::iterator i
= pushes
.begin();
47 int get_cost() const override
{
51 epoch_t
get_map_epoch() const override
{
54 epoch_t
get_min_epoch() const override
{
57 spg_t
get_spg() const override
{
61 void set_cost(uint64_t c
) {
66 : MessageInstance(MSG_OSD_PG_PUSH
, HEAD_VERSION
, COMPAT_VERSION
),
70 void decode_payload() override
{
71 auto p
= payload
.cbegin();
76 decode(pgid
.shard
, p
);
78 if (header
.version
>= 3) {
81 min_epoch
= map_epoch
;
83 if (header
.version
>= 4) {
90 void encode_payload(uint64_t features
) override
{
92 encode(pgid
.pgid
, payload
);
93 encode(map_epoch
, payload
);
94 encode(pushes
, payload
, features
);
95 encode(cost
, payload
);
96 encode(pgid
.shard
, payload
);
97 encode(from
, payload
);
98 encode(min_epoch
, payload
);
99 encode(is_repair
, payload
);
102 std::string_view
get_type_name() const override
{ return "MOSDPGPush"; }
104 void print(ostream
& out
) const override
{
105 out
<< "MOSDPGPush(" << pgid
106 << " " << map_epoch
<< "/" << min_epoch