]>
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) 2013 Inktank Storage, Inc. | |
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 ECBMSGTYPES_H | |
16 | #define ECBMSGTYPES_H | |
17 | ||
18 | #include "osd_types.h" | |
19 | #include "include/buffer.h" | |
20 | #include "os/ObjectStore.h" | |
21 | #include "boost/tuple/tuple.hpp" | |
22 | ||
23 | struct ECSubWrite { | |
24 | pg_shard_t from; | |
25 | ceph_tid_t tid; | |
26 | osd_reqid_t reqid; | |
27 | hobject_t soid; | |
28 | pg_stat_t stats; | |
29 | ObjectStore::Transaction t; | |
30 | eversion_t at_version; | |
31 | eversion_t trim_to; | |
32 | eversion_t roll_forward_to; | |
33 | vector<pg_log_entry_t> log_entries; | |
34 | set<hobject_t> temp_added; | |
35 | set<hobject_t> temp_removed; | |
36 | boost::optional<pg_hit_set_history_t> updated_hit_set_history; | |
37 | bool backfill = false; | |
38 | ECSubWrite() : tid(0) {} | |
39 | ECSubWrite( | |
40 | pg_shard_t from, | |
41 | ceph_tid_t tid, | |
42 | osd_reqid_t reqid, | |
43 | hobject_t soid, | |
44 | const pg_stat_t &stats, | |
45 | const ObjectStore::Transaction &t, | |
46 | eversion_t at_version, | |
47 | eversion_t trim_to, | |
48 | eversion_t roll_forward_to, | |
49 | vector<pg_log_entry_t> log_entries, | |
50 | boost::optional<pg_hit_set_history_t> updated_hit_set_history, | |
51 | const set<hobject_t> &temp_added, | |
52 | const set<hobject_t> &temp_removed, | |
53 | bool backfill) | |
54 | : from(from), tid(tid), reqid(reqid), | |
55 | soid(soid), stats(stats), t(t), | |
56 | at_version(at_version), | |
57 | trim_to(trim_to), roll_forward_to(roll_forward_to), | |
58 | log_entries(log_entries), | |
59 | temp_added(temp_added), | |
60 | temp_removed(temp_removed), | |
61 | updated_hit_set_history(updated_hit_set_history), | |
62 | backfill(backfill) | |
63 | {} | |
64 | void claim(ECSubWrite &other) { | |
65 | from = other.from; | |
66 | tid = other.tid; | |
67 | reqid = other.reqid; | |
68 | soid = other.soid; | |
69 | stats = other.stats; | |
70 | t.swap(other.t); | |
71 | at_version = other.at_version; | |
72 | trim_to = other.trim_to; | |
73 | roll_forward_to = other.roll_forward_to; | |
74 | log_entries.swap(other.log_entries); | |
75 | temp_added.swap(other.temp_added); | |
76 | temp_removed.swap(other.temp_removed); | |
77 | updated_hit_set_history = other.updated_hit_set_history; | |
78 | backfill = other.backfill; | |
79 | } | |
80 | void encode(bufferlist &bl) const; | |
81 | void decode(bufferlist::iterator &bl); | |
82 | void dump(Formatter *f) const; | |
83 | static void generate_test_instances(list<ECSubWrite*>& o); | |
84 | private: | |
85 | // no outside copying -- slow | |
86 | ECSubWrite(ECSubWrite& other); | |
87 | const ECSubWrite& operator=(const ECSubWrite& other); | |
88 | }; | |
89 | WRITE_CLASS_ENCODER(ECSubWrite) | |
90 | ||
91 | struct ECSubWriteReply { | |
92 | pg_shard_t from; | |
93 | ceph_tid_t tid; | |
94 | eversion_t last_complete; | |
95 | bool committed; | |
96 | bool applied; | |
97 | ECSubWriteReply() : tid(0), committed(false), applied(false) {} | |
98 | void encode(bufferlist &bl) const; | |
99 | void decode(bufferlist::iterator &bl); | |
100 | void dump(Formatter *f) const; | |
101 | static void generate_test_instances(list<ECSubWriteReply*>& o); | |
102 | }; | |
103 | WRITE_CLASS_ENCODER(ECSubWriteReply) | |
104 | ||
105 | struct ECSubRead { | |
106 | pg_shard_t from; | |
107 | ceph_tid_t tid; | |
108 | map<hobject_t, list<boost::tuple<uint64_t, uint64_t, uint32_t> >> to_read; | |
109 | set<hobject_t> attrs_to_read; | |
110 | void encode(bufferlist &bl, uint64_t features) const; | |
111 | void decode(bufferlist::iterator &bl); | |
112 | void dump(Formatter *f) const; | |
113 | static void generate_test_instances(list<ECSubRead*>& o); | |
114 | }; | |
115 | WRITE_CLASS_ENCODER_FEATURES(ECSubRead) | |
116 | ||
117 | struct ECSubReadReply { | |
118 | pg_shard_t from; | |
119 | ceph_tid_t tid; | |
120 | map<hobject_t, list<pair<uint64_t, bufferlist> >> buffers_read; | |
121 | map<hobject_t, map<string, bufferlist>> attrs_read; | |
122 | map<hobject_t, int> errors; | |
123 | void encode(bufferlist &bl) const; | |
124 | void decode(bufferlist::iterator &bl); | |
125 | void dump(Formatter *f) const; | |
126 | static void generate_test_instances(list<ECSubReadReply*>& o); | |
127 | }; | |
128 | WRITE_CLASS_ENCODER(ECSubReadReply) | |
129 | ||
130 | std::ostream &operator<<( | |
131 | std::ostream &lhs, const ECSubWrite &rhs); | |
132 | std::ostream &operator<<( | |
133 | std::ostream &lhs, const ECSubWriteReply &rhs); | |
134 | std::ostream &operator<<( | |
135 | std::ostream &lhs, const ECSubRead &rhs); | |
136 | std::ostream &operator<<( | |
137 | std::ostream &lhs, const ECSubReadReply &rhs); | |
138 | ||
139 | #endif |