]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGCreate.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / messages / MOSDPGCreate.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7 *
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.
12 *
13 */
14
15
16#ifndef CEPH_MOSDPGCREATE_H
17#define CEPH_MOSDPGCREATE_H
18
19#include "msg/Message.h"
20#include "osd/osd_types.h"
21
22/*
23 * PGCreate - instruct an OSD to create a pg, if it doesn't already exist
24 */
25
f67539c2 26class MOSDPGCreate final : public Message {
11fdf7f2 27public:
11fdf7f2
TL
28 static constexpr int HEAD_VERSION = 3;
29 static constexpr int COMPAT_VERSION = 3;
7c673cae 30
d2e6a577 31 version_t epoch = 0;
f67539c2
TL
32 std::map<pg_t,pg_create_t> mkpg;
33 std::map<pg_t,utime_t> ctimes;
7c673cae
FG
34
35 MOSDPGCreate()
9f95a23c
TL
36 : MOSDPGCreate{0}
37 {}
7c673cae 38 MOSDPGCreate(epoch_t e)
9f95a23c
TL
39 : Message{MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION},
40 epoch(e)
41 {}
7c673cae 42private:
f67539c2 43 ~MOSDPGCreate() final {}
7c673cae 44
f67539c2 45public:
11fdf7f2 46 std::string_view get_type_name() const override { return "pg_create"; }
7c673cae
FG
47
48 void encode_payload(uint64_t features) override {
11fdf7f2
TL
49 using ceph::encode;
50 encode(epoch, payload);
51 encode(mkpg, payload);
52 encode(ctimes, payload);
7c673cae
FG
53 }
54 void decode_payload() override {
f67539c2 55 using ceph::decode;
11fdf7f2
TL
56 auto p = payload.cbegin();
57 decode(epoch, p);
58 decode(mkpg, p);
59 decode(ctimes, p);
7c673cae 60 }
f67539c2 61 void print(std::ostream& out) const override {
7c673cae 62 out << "osd_pg_create(e" << epoch;
f67539c2 63 for (auto i = mkpg.begin(); i != mkpg.end(); ++i) {
7c673cae
FG
64 out << " " << i->first << ":" << i->second.created;
65 }
66 out << ")";
67 }
9f95a23c
TL
68private:
69 template<class T, typename... Args>
70 friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
7c673cae
FG
71};
72
73#endif