]> git.proxmox.com Git - ceph.git/blame - ceph/src/osd/ECMsgTypes.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / osd / ECMsgTypes.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) 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
23struct 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;
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,
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,
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
FG
79 }
80 void encode(bufferlist &bl) const;
11fdf7f2 81 void decode(bufferlist::const_iterator &bl);
7c673cae
FG
82 void dump(Formatter *f) const;
83 static void generate_test_instances(list<ECSubWrite*>& o);
84private:
85 // no outside copying -- slow
86 ECSubWrite(ECSubWrite& other);
87 const ECSubWrite& operator=(const ECSubWrite& other);
88};
89WRITE_CLASS_ENCODER(ECSubWrite)
90
91struct 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;
11fdf7f2 99 void decode(bufferlist::const_iterator &bl);
7c673cae
FG
100 void dump(Formatter *f) const;
101 static void generate_test_instances(list<ECSubWriteReply*>& o);
102};
103WRITE_CLASS_ENCODER(ECSubWriteReply)
104
105struct 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;
11fdf7f2 110 map<hobject_t, vector<pair<int, int>>> subchunks;
7c673cae 111 void encode(bufferlist &bl, uint64_t features) const;
11fdf7f2 112 void decode(bufferlist::const_iterator &bl);
7c673cae
FG
113 void dump(Formatter *f) const;
114 static void generate_test_instances(list<ECSubRead*>& o);
115};
116WRITE_CLASS_ENCODER_FEATURES(ECSubRead)
117
118struct ECSubReadReply {
119 pg_shard_t from;
120 ceph_tid_t tid;
121 map<hobject_t, list<pair<uint64_t, bufferlist> >> buffers_read;
122 map<hobject_t, map<string, bufferlist>> attrs_read;
123 map<hobject_t, int> errors;
124 void encode(bufferlist &bl) const;
11fdf7f2 125 void decode(bufferlist::const_iterator &bl);
7c673cae
FG
126 void dump(Formatter *f) const;
127 static void generate_test_instances(list<ECSubReadReply*>& o);
128};
129WRITE_CLASS_ENCODER(ECSubReadReply)
130
131std::ostream &operator<<(
132 std::ostream &lhs, const ECSubWrite &rhs);
133std::ostream &operator<<(
134 std::ostream &lhs, const ECSubWriteReply &rhs);
135std::ostream &operator<<(
136 std::ostream &lhs, const ECSubRead &rhs);
137std::ostream &operator<<(
138 std::ostream &lhs, const ECSubReadReply &rhs);
139
140#endif