]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDPGCreate.h
update sources to v12.1.3
[ceph.git] / ceph / src / messages / MOSDPGCreate.h
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
26 struct MOSDPGCreate : public Message {
27
28 const static int HEAD_VERSION = 3;
29 const static int COMPAT_VERSION = 3;
30
31 version_t epoch = 0;
32 map<pg_t,pg_create_t> mkpg;
33 map<pg_t,utime_t> ctimes;
34
35 MOSDPGCreate()
36 : Message(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION) {}
37 MOSDPGCreate(epoch_t e)
38 : Message(MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION),
39 epoch(e) { }
40 private:
41 ~MOSDPGCreate() override {}
42
43 public:
44 const char *get_type_name() const override { return "pg_create"; }
45
46 void encode_payload(uint64_t features) override {
47 ::encode(epoch, payload);
48 ::encode(mkpg, payload);
49 ::encode(ctimes, payload);
50 }
51 void decode_payload() override {
52 bufferlist::iterator p = payload.begin();
53 ::decode(epoch, p);
54 ::decode(mkpg, p);
55 ::decode(ctimes, p);
56 }
57
58 void print(ostream& out) const override {
59 out << "osd_pg_create(e" << epoch;
60 for (map<pg_t,pg_create_t>::const_iterator i = mkpg.begin();
61 i != mkpg.end();
62 ++i) {
63 out << " " << i->first << ":" << i->second.created;
64 }
65 out << ")";
66 }
67 };
68
69 #endif