1 //
2 // Copyright (C) 2013-2018 Codership Oy <info@codership.com>
3 //
4
5 #ifndef GALERA_KEY_DATA_HPP
6 #define GALERA_KEY_DATA_HPP
7
8 #include "wsrep_api.h"
9
10 #include <ostream>
11
12 namespace galera
13 {
14
15 struct KeyData
16 {
17 const wsrep_buf_t* const parts;
18 long const parts_num;
19 int const proto_ver;
20 wsrep_key_type_t const type;
21 bool const copy;
22
KeyDatagalera::KeyData23 KeyData (int const pv, const wsrep_buf_t* const k,
24 long const kn, wsrep_key_type_t const tp, bool const cp)
25 : parts (k),
26 parts_num (kn),
27 proto_ver (pv),
28 type (tp),
29 copy (cp)
30 {}
31
KeyDatagalera::KeyData32 KeyData (const KeyData& kd)
33 : parts (kd.parts),
34 parts_num(kd.parts_num),
35 proto_ver(kd.proto_ver),
36 type (kd.type),
37 copy (kd.copy)
38 {}
39
sharedgalera::KeyData40 bool shared() const { return type == WSREP_KEY_SHARED; }
41
42 void print(std::ostream& os) const;
43
44 private:
45
46 KeyData& operator = (const KeyData&);
47
48 }; /* struct KeyData */
49
50 inline std::ostream&
operator <<(std::ostream & os,const KeyData & kd)51 operator << (std::ostream& os, const KeyData& kd)
52 {
53 kd.print(os);
54 return os;
55 }
56
57 } /* namespace galera */
58
59 #endif /* GALERA_KEY_DATA_HPP */
60