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 MOSDPGPull : public MOSDFastDispatchOp {
21 static const int HEAD_VERSION = 3;
22 static const int COMPAT_VERSION = 2;
29 epoch_t map_epoch, min_epoch;
32 epoch_t get_map_epoch() const override {
35 epoch_t get_min_epoch() const override {
38 spg_t get_spg() const override {
42 void take_pulls(vector<PullOp> *outpulls) {
43 outpulls->swap(pulls);
45 void set_pulls(vector<PullOp> *inpulls) {
50 : MOSDFastDispatchOp(MSG_OSD_PG_PULL, HEAD_VERSION, COMPAT_VERSION),
54 void compute_cost(CephContext *cct) {
56 for (vector<PullOp>::iterator i = pulls.begin();
63 int get_cost() const override {
67 void decode_payload() override {
68 bufferlist::iterator p = payload.begin();
69 ::decode(pgid.pgid, p);
70 ::decode(map_epoch, p);
73 ::decode(pgid.shard, p);
75 if (header.version >= 3) {
76 ::decode(min_epoch, p);
78 min_epoch = map_epoch;
82 void encode_payload(uint64_t features) override {
83 ::encode(pgid.pgid, payload);
84 ::encode(map_epoch, payload);
85 ::encode(pulls, payload, features);
86 ::encode(cost, payload);
87 ::encode(pgid.shard, payload);
88 ::encode(from, payload);
89 ::encode(min_epoch, payload);
92 const char *get_type_name() const override { return "MOSDPGPull"; }
94 void print(ostream& out) const override {
95 out << "MOSDPGPull(" << pgid
96 << " e" << map_epoch << "/" << min_epoch