]>
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; | |
f67539c2 | 33 | std::vector<pg_log_entry_t> log_entries; |
9f95a23c TL |
34 | std::set<hobject_t> temp_added; |
35 | std::set<hobject_t> temp_removed; | |
36 | std::optional<pg_hit_set_history_t> updated_hit_set_history; | |
11fdf7f2 | 37 | bool backfill_or_async_recovery = false; |
7c673cae FG |
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, | |
f67539c2 | 49 | std::vector<pg_log_entry_t> log_entries, |
9f95a23c TL |
50 | std::optional<pg_hit_set_history_t> updated_hit_set_history, |
51 | const std::set<hobject_t> &temp_added, | |
52 | const std::set<hobject_t> &temp_removed, | |
11fdf7f2 | 53 | bool backfill_or_async_recovery) |
7c673cae FG |
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), | |
11fdf7f2 | 62 | backfill_or_async_recovery(backfill_or_async_recovery) |
7c673cae FG |
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; | |
11fdf7f2 | 78 | backfill_or_async_recovery = other.backfill_or_async_recovery; |
7c673cae | 79 | } |
9f95a23c TL |
80 | void encode(ceph::buffer::list &bl) const; |
81 | void decode(ceph::buffer::list::const_iterator &bl); | |
82 | void dump(ceph::Formatter *f) const; | |
83 | static void generate_test_instances(std::list<ECSubWrite*>& o); | |
7c673cae FG |
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) {} | |
9f95a23c TL |
98 | void encode(ceph::buffer::list &bl) const; |
99 | void decode(ceph::buffer::list::const_iterator &bl); | |
100 | void dump(ceph::Formatter *f) const; | |
101 | static void generate_test_instances(std::list<ECSubWriteReply*>& o); | |
7c673cae FG |
102 | }; |
103 | WRITE_CLASS_ENCODER(ECSubWriteReply) | |
104 | ||
105 | struct ECSubRead { | |
106 | pg_shard_t from; | |
107 | ceph_tid_t tid; | |
9f95a23c TL |
108 | std::map<hobject_t, std::list<boost::tuple<uint64_t, uint64_t, uint32_t> >> to_read; |
109 | std::set<hobject_t> attrs_to_read; | |
110 | std::map<hobject_t, std::vector<std::pair<int, int>>> subchunks; | |
111 | void encode(ceph::buffer::list &bl, uint64_t features) const; | |
112 | void decode(ceph::buffer::list::const_iterator &bl); | |
113 | void dump(ceph::Formatter *f) const; | |
114 | static void generate_test_instances(std::list<ECSubRead*>& o); | |
7c673cae FG |
115 | }; |
116 | WRITE_CLASS_ENCODER_FEATURES(ECSubRead) | |
117 | ||
118 | struct ECSubReadReply { | |
119 | pg_shard_t from; | |
120 | ceph_tid_t tid; | |
9f95a23c | 121 | std::map<hobject_t, std::list<std::pair<uint64_t, ceph::buffer::list> >> buffers_read; |
20effc67 | 122 | std::map<hobject_t, std::map<std::string, ceph::buffer::list, std::less<>>> attrs_read; |
9f95a23c TL |
123 | std::map<hobject_t, int> errors; |
124 | void encode(ceph::buffer::list &bl) const; | |
125 | void decode(ceph::buffer::list::const_iterator &bl); | |
126 | void dump(ceph::Formatter *f) const; | |
127 | static void generate_test_instances(std::list<ECSubReadReply*>& o); | |
7c673cae FG |
128 | }; |
129 | WRITE_CLASS_ENCODER(ECSubReadReply) | |
130 | ||
131 | std::ostream &operator<<( | |
132 | std::ostream &lhs, const ECSubWrite &rhs); | |
133 | std::ostream &operator<<( | |
134 | std::ostream &lhs, const ECSubWriteReply &rhs); | |
135 | std::ostream &operator<<( | |
136 | std::ostream &lhs, const ECSubRead &rhs); | |
137 | std::ostream &operator<<( | |
138 | std::ostream &lhs, const ECSubReadReply &rhs); | |
139 | ||
140 | #endif |