]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MOSDPGCreate.h
update sources to ceph Nautilus 14.2.1
[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
11fdf7f2
TL
26class MOSDPGCreate : public MessageInstance<MOSDPGCreate> {
27public:
28 friend factory;
7c673cae 29
11fdf7f2
TL
30 static constexpr int HEAD_VERSION = 3;
31 static constexpr int COMPAT_VERSION = 3;
7c673cae 32
d2e6a577 33 version_t epoch = 0;
7c673cae
FG
34 map<pg_t,pg_create_t> mkpg;
35 map<pg_t,utime_t> ctimes;
36
37 MOSDPGCreate()
11fdf7f2 38 : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION) {}
7c673cae 39 MOSDPGCreate(epoch_t e)
11fdf7f2 40 : MessageInstance(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION),
7c673cae
FG
41 epoch(e) { }
42private:
43 ~MOSDPGCreate() override {}
44
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 {
11fdf7f2
TL
55 auto p = payload.cbegin();
56 decode(epoch, p);
57 decode(mkpg, p);
58 decode(ctimes, p);
7c673cae
FG
59 }
60
61 void print(ostream& out) const override {
62 out << "osd_pg_create(e" << epoch;
63 for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin();
64 i != mkpg.end();
65 ++i) {
66 out << " " << i->first << ":" << i->second.created;
67 }
68 out << ")";
69 }
70};
71
72#endif