PrivMX Endpoint v2.7.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
17
18class StoreApiImpl;
19
24public:
32 static StoreApi create(core::Connection& connection);
33
38 StoreApi(const StoreApi& obj);
39 StoreApi& operator=(const StoreApi& obj);
40 StoreApi(StoreApi&& obj);
41 ~StoreApi();
42
55 std::string createStore(const std::string& contextId, const std::vector<core::UserWithPubKey>& users,
56 const std::vector<core::UserWithPubKey>& managers, const core::Buffer& publicMeta, const core::Buffer& privateMeta,
57 const std::optional<core::ContainerPolicy>& policies = std::nullopt);
58
73 void updateStore(const std::string& storeId, const std::vector<core::UserWithPubKey>& users,
74 const std::vector<core::UserWithPubKey>& managers, const core::Buffer& publicMeta, const core::Buffer& privateMeta, const int64_t version,
75 const bool force, const bool forceGenerateNewKey,
76 const std::optional<core::ContainerPolicy>& policies = std::nullopt);
77
83 void deleteStore(const std::string& storeId);
84
91 Store getStore(const std::string& storeId);
92
100 core::PagingList<Store> listStores(const std::string& contextId, const core::PagingQuery& pagingQuery);
101
112 int64_t createFile(const std::string& storeId, const core::Buffer& publicMeta, const core::Buffer& privateMeta,
113 const int64_t size, bool randomWriteSupport = false);
114
124 int64_t updateFile(const std::string& fileId, const core::Buffer& publicMeta, const core::Buffer& privateMeta,
125 const int64_t size);
126
134 void updateFileMeta(const std::string& fileId, const core::Buffer& publicMeta, const core::Buffer& privateMeta);
135
143 void writeToFile(const int64_t fileHandle, const core::Buffer& dataChunk, bool truncate = false);
144
150 void deleteFile(const std::string& fileId);
151
158 File getFile(const std::string& fileId);
159
167 core::PagingList<File> listFiles(const std::string& storeId, const core::PagingQuery& pagingQuery);
168
175 int64_t openFile(const std::string& fileId);
176
185 core::Buffer readFromFile(const int64_t fileHandle, const int64_t length);
186
193 void seekInFile(const int64_t fileHandle, const int64_t position);
194
201 std::string closeFile(const int64_t fileHandle);
202
209 std::vector<std::string> subscribeFor(const std::vector<std::string>& subscriptionQueries);
210
215 void unsubscribeFrom(const std::vector<std::string>& subscriptionIds);
216
223 std::string buildSubscriptionQuery(EventType eventType, EventSelectorType selectorType, const std::string& selectorId);
224
229 void syncFile(const int64_t fileHandle);
230
231private:
232 StoreApi(const std::shared_ptr<StoreApiImpl>& impl);
233};
234
235} // namespace store
236} // namespace endpoint
237} // namespace privmx
238
239#endif // _PRIVMXLIB_ENDPOINT_STORE_STOREAPI_HPP_
Definition Buffer.hpp:13
Definition Connection.hpp:22
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:60
Definition Types.hpp:107