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 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) {}
44 const pg_stat_t
&stats
,
45 const ObjectStore::Transaction
&t
,
46 eversion_t at_version
,
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
,
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
),
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
= other
.backfill
;
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
);
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(bufferlist
&bl
) const;
99 void decode(bufferlist::iterator
&bl
);
100 void dump(Formatter
*f
) const;
101 static void generate_test_instances(list
<ECSubWriteReply
*>& o
);
103 WRITE_CLASS_ENCODER(ECSubWriteReply
)
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
);
115 WRITE_CLASS_ENCODER_FEATURES(ECSubRead
)
117 struct ECSubReadReply
{
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
);
128 WRITE_CLASS_ENCODER(ECSubReadReply
)
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
);