PrivMX Endpoint v2.8.0
Loading...
Searching...
No Matches
StoreApi.hpp
1#ifndef _PRIVMXLIB_ENDPOINT_STORE_STOREAPI_HPP_
2#define _PRIVMXLIB_ENDPOINT_STORE_STOREAPI_HPP_
3
4#include <memory>
5#include <optional>
6#include <string>
7#include <vector>
8
9#include "privmx/endpoint/core/Connection.hpp"
10#include "privmx/endpoint/store/Types.hpp"
11#include <privmx/endpoint/core/ExtendedPointer.hpp>
12
13namespace privmx {
14namespace endpoint {
15namespace store {
16
17class StoreApiImpl;
18
23public:
31 static StoreApi create(core::Connection& connection);
32
37 StoreApi(const StoreApi& obj);
38 StoreApi& operator=(const StoreApi& obj);
39 StoreApi(StoreApi&& obj);
40 ~StoreApi();
41
54 std::string createStore(
55 const std::string& contextId,
56 const std::vector<core::UserWithPubKey>& users,
57 const std::vector<core::UserWithPubKey>& managers,
58 const core::Buffer& publicMeta,
59 const core::Buffer& privateMeta,
60 const std::optional<core::ContainerPolicy>& policies = std::nullopt
61 );
62
78 const std::string& storeId,
79 const std::vector<core::UserWithPubKey>& users,
80 const std::vector<core::UserWithPubKey>& managers,
81 const core::Buffer& publicMeta,
82 const core::Buffer& privateMeta,
83 const int64_t version,
84 const bool force,
85 const bool forceGenerateNewKey,
86 const std::optional<core::ContainerPolicy>& policies = std::nullopt
87 );
88
94 void deleteStore(const std::string& storeId);
95
102 Store getStore(const std::string& storeId);
103
111 core::PagingList<Store> listStores(const std::string& contextId, const core::PagingQuery& pagingQuery);
112
123 int64_t createFile(
124 const std::string& storeId,
125 const core::Buffer& publicMeta,
126 const core::Buffer& privateMeta,
127 const int64_t size,
128 bool randomWriteSupport = false
129 );
130
140 int64_t updateFile(
141 const std::string& fileId,
142 const core::Buffer& publicMeta,
143 const core::Buffer& privateMeta,
144 const int64_t size
145 );
146
154 void updateFileMeta(const std::string& fileId, const core::Buffer& publicMeta, const core::Buffer& privateMeta);
155
163 void writeToFile(const int64_t fileHandle, const core::Buffer& dataChunk, bool truncate = false);
164
170 void deleteFile(const std::string& fileId);
171
178 File getFile(const std::string& fileId);
179
187 core::PagingList<File> listFiles(const std::string& storeId, const core::PagingQuery& pagingQuery);
188
195 int64_t openFile(const std::string& fileId);
196
205 core::Buffer readFromFile(const int64_t fileHandle, const int64_t length);
206
213 void seekInFile(const int64_t fileHandle, const int64_t position);
214
221 std::string closeFile(const int64_t fileHandle);
222
229 std::vector<std::string> subscribeFor(const std::vector<std::string>& subscriptionQueries);
230
235 void unsubscribeFrom(const std::vector<std::string>& subscriptionIds);
236
244 EventType eventType,
245 EventSelectorType selectorType,
246 const std::string& selectorId
247 );
248
253 void syncFile(const int64_t fileHandle);
254
255private:
256 StoreApi(const std::shared_ptr<StoreApiImpl>& impl);
257};
258
259} // namespace store
260} // namespace endpoint
261} // namespace privmx
262
263#endif // _PRIVMXLIB_ENDPOINT_STORE_STOREAPI_HPP_
Definition Buffer.hpp:13
Definition Connection.hpp:21
Definition ExtendedPointer.hpp:16
void updateFileMeta(const std::string &fileId, const core::Buffer &publicMeta, const core::Buffer &privateMeta)
core::PagingList< Store > listStores(const std::string &contextId, const core::PagingQuery &pagingQuery)
void updateStore(const std::string &storeId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t version, const bool force, const bool forceGenerateNewKey, const std::optional< core::ContainerPolicy > &policies=std::nullopt)
File getFile(const std::string &fileId)
Store getStore(const std::string &storeId)
core::PagingList< File > listFiles(const std::string &storeId, const core::PagingQuery &pagingQuery)
void unsubscribeFrom(const std::vector< std::string > &subscriptionIds)
std::string closeFile(const int64_t fileHandle)
int64_t updateFile(const std::string &fileId, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t size)
std::vector< std::string > subscribeFor(const std::vector< std::string > &subscriptionQueries)
void writeToFile(const int64_t fileHandle, const core::Buffer &dataChunk, bool truncate=false)
core::Buffer readFromFile(const int64_t fileHandle, const int64_t length)
void seekInFile(const int64_t fileHandle, const int64_t position)
void deleteStore(const std::string &storeId)
static StoreApi create(core::Connection &connection)
std::string createStore(const std::string &contextId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const std::optional< core::ContainerPolicy > &policies=std::nullopt)
int64_t openFile(const std::string &fileId)
int64_t createFile(const std::string &storeId, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t size, bool randomWriteSupport=false)
void deleteFile(const std::string &fileId)
std::string buildSubscriptionQuery(EventType eventType, EventSelectorType selectorType, const std::string &selectorId)
void syncFile(const int64_t fileHandle)
Definition Types.hpp:16
Definition Types.hpp:59
Definition Types.hpp:105