1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 Inktank Storage, Inc.
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.
18 #include "osd_types.h"
19 #include "include/buffer.h"
20 #include "os/ObjectStore.h"
21 #include "boost/tuple/tuple.hpp"
29 ObjectStore::Transaction t
;
30 eversion_t at_version
;
32 eversion_t roll_forward_to
;
33 std::vector
<pg_log_entry_t
> log_entries
;
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
;
37 bool backfill_or_async_recovery
= false;
38 ECSubWrite() : tid(0) {}
44 const pg_stat_t
&stats
,
45 const ObjectStore::Transaction
&t
,
46 eversion_t at_version
,
48 eversion_t roll_forward_to
,
49 std::vector
<pg_log_entry_t
> log_entries
,
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
,
53 bool backfill_or_async_recovery
)
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_or_async_recovery(backfill_or_async_recovery
)
64 void claim(ECSubWrite
&other
) {
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_or_async_recovery
= other
.backfill_or_async_recovery
;
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
);
85 // no outside copying -- slow
86 ECSubWrite(ECSubWrite
& other
);
87 const ECSubWrite
& operator=(const ECSubWrite
& other
);
89 WRITE_CLASS_ENCODER(ECSubWrite
)
91 struct ECSubWriteReply
{
94 eversion_t last_complete
;
97 ECSubWriteReply() : tid(0), committed(false), applied(false) {}
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
);
103 WRITE_CLASS_ENCODER(ECSubWriteReply
)
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
);
116 WRITE_CLASS_ENCODER_FEATURES(ECSubRead
)
118 struct ECSubReadReply
{
121 std::map
<hobject_t
, std::list
<std::pair
<uint64_t, ceph::buffer::list
> >> buffers_read
;
122 std::map
<hobject_t
, std::map
<std::string
, ceph::buffer::list
, std::less
<>>> attrs_read
;
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
);
129 WRITE_CLASS_ENCODER(ECSubReadReply
)
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
);