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 {
21 static const int HEAD_VERSION = 3;
22 static const int COMPAT_VERSION = 2;
27 epoch_t map_epoch, min_epoch;
28 vector<PushOp> pushes;
34 void compute_cost(CephContext *cct) {
36 for (vector<PushOp>::iterator i = pushes.begin();
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),
66 void decode_payload() override {
67 bufferlist::iterator p = payload.begin();
68 ::decode(pgid.pgid, p);
69 ::decode(map_epoch, p);
72 ::decode(pgid.shard, p);
74 if (header.version >= 3) {
75 ::decode(min_epoch, p);
77 min_epoch = map_epoch;
81 void encode_payload(uint64_t features) override {
82 ::encode(pgid.pgid, payload);
83 ::encode(map_epoch, payload);
84 ::encode(pushes, payload, features);
85 ::encode(cost, payload);
86 ::encode(pgid.shard, payload);
87 ::encode(from, payload);
88 ::encode(min_epoch, payload);
91 const char *get_type_name() const override { return "MOSDPGPush"; }
93 void print(ostream& out) const override {
94 out << "MOSDPGPush(" << pgid
95 << " " << map_epoch << "/" << min_epoch