Kinetic C/C++ Client
 All Classes Functions Variables Pages
threadsafe_blocking_kinetic_connection.h
1 /*
2  * kinetic-cpp-client
3  * Copyright (C) 2014 Seagate Technology.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #ifndef KINETIC_CPP_CLIENT_THREADSAFE_BLOCKING_KINETIC_CONNECTION_H_
22 #define KINETIC_CPP_CLIENT_THREADSAFE_BLOCKING_KINETIC_CONNECTION_H_
23 
24 
25 #include "kinetic/blocking_kinetic_connection.h"
26 #include <mutex>
27 
28 namespace kinetic {
29 
30 using std::shared_ptr;
31 using std::unique_ptr;
32 using std::string;
33 
35  public:
37  unique_ptr<BlockingKineticConnection> connection);
39 
40  void SetClientClusterVersion(int64_t cluster_version);
41 
42  KineticStatus NoOp();
43 
44  KineticStatus Get(
45  const shared_ptr<const string> key,
46  unique_ptr<KineticRecord>& record);
47 
48  KineticStatus Get(const string& key, unique_ptr<KineticRecord>& record);
49 
50  KineticStatus GetNext(
51  const shared_ptr<const string> key,
52  unique_ptr<string>& actual_key,
53  unique_ptr<KineticRecord>& record);
54 
55  KineticStatus GetNext(
56  const string& key,
57  unique_ptr<string>& actual_key,
58  unique_ptr<KineticRecord>& record);
59 
60  KineticStatus GetPrevious(const shared_ptr<const string> key,
61  unique_ptr<string>& actual_key,
62  unique_ptr<KineticRecord>& record);
63 
64  KineticStatus GetPrevious(const string& key,
65  unique_ptr<string>& actual_key,
66  unique_ptr<KineticRecord>& record);
67 
68  KineticStatus GetVersion(const shared_ptr<const string> key,
69  unique_ptr<string>& version);
70 
71  KineticStatus GetVersion(const string& key, unique_ptr<string>& version);
72 
73  KineticStatus GetKeyRange(const shared_ptr<const string> start_key,
74  bool start_key_inclusive,
75  const shared_ptr<const string> end_key,
76  bool end_key_inclusive,
77  bool reverse_results,
78  int32_t max_results,
79  unique_ptr<vector<string>>& keys);
80 
81  KineticStatus GetKeyRange(const string& start_key,
82  bool start_key_inclusive,
83  const string& end_key,
84  bool end_key_inclusive,
85  bool reverse_results,
86  int32_t max_results,
87  unique_ptr<vector<string>>& keys);
88 
89  KeyRangeIterator IterateKeyRange(const shared_ptr<const string> start_key,
90  bool start_key_inclusive,
91  const shared_ptr<const string> end_key,
92  bool end_key_inclusive,
93  unsigned int frame_size);
94 
95  KeyRangeIterator IterateKeyRange(const string& start_key,
96  bool start_key_inclusive,
97  const string& end_key,
98  bool end_key_inclusive,
99  unsigned int frame_size);
100 
101  KineticStatus Put(const shared_ptr<const string> key,
102  const shared_ptr<const string> current_version, WriteMode mode,
103  const shared_ptr<const KineticRecord> record,
104  PersistMode persistMode);
105 
106  KineticStatus Put(const string& key,
107  const string& current_version, WriteMode mode,
108  const KineticRecord& record,
109  PersistMode persistMode);
110 
111  KineticStatus Put(const shared_ptr<const string> key,
112  const shared_ptr<const string> current_version, WriteMode mode,
113  const shared_ptr<const KineticRecord> record);
114 
115  KineticStatus Put(const string& key,
116  const string& current_version, WriteMode mode,
117  const KineticRecord& record);
118 
119  KineticStatus Delete(const shared_ptr<const string> key,
120  const shared_ptr<const string> version, WriteMode mode, PersistMode persistMode);
121 
122  KineticStatus Delete(const string& key, const string& version,
123  WriteMode mode, PersistMode persistMode);
124 
125  KineticStatus Delete(const shared_ptr<const string> key,
126  const shared_ptr<const string> version, WriteMode mode);
127 
128  KineticStatus Delete(const string& key, const string& version, WriteMode mode);
129 
130  KineticStatus GetLog(unique_ptr<DriveLog>& drive_log);
131 
132  KineticStatus GetLog(const vector<Command_GetLog_Type>& types, unique_ptr<DriveLog>& drive_log);
133 
134  KineticStatus P2PPush(const P2PPushRequest& push_request,
135  unique_ptr<vector<KineticStatus>>& operation_statuses);
136 
137  KineticStatus P2PPush(const shared_ptr<const P2PPushRequest> push_request,
138  unique_ptr<vector<KineticStatus>>& operation_statuses);
139 
140  KineticStatus SetClusterVersion(int64_t cluster_version);
141  KineticStatus UpdateFirmware(const shared_ptr<const string> new_firmware);
142  KineticStatus SetACLs(const shared_ptr<const list<ACL>> acls);
143 
144  KineticStatus SetErasePIN(const shared_ptr<const string> new_pin,
145  const shared_ptr<const string> current_pin = make_shared<string>());
146  KineticStatus SetErasePIN(const string& new_pin, const string& current_pin);
147  KineticStatus SetLockPIN(const shared_ptr<const string> new_pin,
148  const shared_ptr<const string> current_pin = make_shared<string>());
149  KineticStatus SetLockPIN(const string& new_pin, const string& current_pin);
150  KineticStatus InstantErase(const shared_ptr<string> pin);
151  KineticStatus InstantErase(const string& pin);
152  KineticStatus SecureErase(const shared_ptr<string> pin);
153  KineticStatus SecureErase(const string& pin);
154  KineticStatus LockDevice(const shared_ptr<string> pin);
155  KineticStatus LockDevice(const string& pin);
156  KineticStatus UnlockDevice(const shared_ptr<string> pin);
157  KineticStatus UnlockDevice(const string& pin);
158 
159 
160  private:
161  std::recursive_mutex mutex_;
162  unique_ptr<BlockingKineticConnection> connection_;
163 };
164 
165 } // namespace kinetic
166 
167 #endif // KINETIC_CPP_CLIENT_THREADSAFE_BLOCKING_KINETIC_CONNECTION_H_
Represents a collection of P2P operations.
Indicates whether a Kinetic operation (get, put, security, etc) put succeeded or failed. Unlike Status it provides details like whether the failure resulted from a version or an HMAC error.
Encapsulates a single value stored in a Kinetic drive and the associated metadata.