]>
Commit | Line | Data |
---|---|---|
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) 2014 Red Hat | |
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 | #ifndef CEPH_MMONGETOSDMAP_H | |
16 | #define CEPH_MMONGETOSDMAP_H | |
17 | ||
18 | #include "msg/Message.h" | |
19 | ||
20 | #include "include/types.h" | |
21 | ||
22 | class MMonGetOSDMap : public PaxosServiceMessage { | |
23 | epoch_t full_first, full_last; | |
24 | epoch_t inc_first, inc_last; | |
25 | ||
26 | public: | |
27 | MMonGetOSDMap() | |
28 | : PaxosServiceMessage(CEPH_MSG_MON_GET_OSDMAP, 0), | |
29 | full_first(0), | |
30 | full_last(0), | |
31 | inc_first(0), | |
32 | inc_last(0) { } | |
33 | private: | |
34 | ~MMonGetOSDMap() override {} | |
35 | ||
36 | public: | |
37 | void request_full(epoch_t first, epoch_t last) { | |
38 | assert(last >= first); | |
39 | full_first = first; | |
40 | full_last = last; | |
41 | } | |
42 | void request_inc(epoch_t first, epoch_t last) { | |
43 | assert(last >= first); | |
44 | inc_first = first; | |
45 | inc_last = last; | |
46 | } | |
47 | epoch_t get_full_first() const { | |
48 | return full_first; | |
49 | } | |
50 | epoch_t get_full_last() const { | |
51 | return full_last; | |
52 | } | |
53 | epoch_t get_inc_first() const { | |
54 | return inc_first; | |
55 | } | |
56 | epoch_t get_inc_last() const { | |
57 | return inc_last; | |
58 | } | |
59 | ||
60 | const char *get_type_name() const override { return "mon_get_osdmap"; } | |
61 | void print(ostream& out) const override { | |
62 | out << "mon_get_osdmap("; | |
63 | if (full_first && full_last) | |
64 | out << "full " << full_first << "-" << full_last; | |
65 | if (inc_first && inc_last) | |
66 | out << " inc" << inc_first << "-" << inc_last; | |
67 | out << ")"; | |
68 | } | |
69 | ||
70 | void encode_payload(uint64_t features) override { | |
71 | paxos_encode(); | |
72 | ::encode(full_first, payload); | |
73 | ::encode(full_last, payload); | |
74 | ::encode(inc_first, payload); | |
75 | ::encode(inc_last, payload); | |
76 | } | |
77 | void decode_payload() override { | |
78 | bufferlist::iterator p = payload.begin(); | |
79 | paxos_decode(p); | |
80 | ::decode(full_first, p); | |
81 | ::decode(full_last, p); | |
82 | ::decode(inc_first, p); | |
83 | ::decode(inc_last, p); | |
84 | } | |
85 | }; | |
86 | ||
87 | #endif |