StoreApi
namespace: privmx::endpoint::store
StoreApi is a class representing Endpoint's API for Stores and their files.
Static Methods
create
Creates an instance of StoreApi
static StoreApi create(
core::Connection &connection
)
Name | Type | Description |
---|
connection | core::Connection & | instance of 'Connection' |
Methods
createStore
Creates a new Store in given Context.
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
)
Name | Type | Description |
---|
contextId | const std::string & | ID of the Context to create the Store in |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Store |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
policies | const std::optional<core::ContainerPolicy> & | Store policies |
Type | Description |
---|
std::string | created Store ID |
updateStore
Updates an existing Store
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
)
Name | Type | Description |
---|
storeId | const std::string & | ID of the Store to update |
users | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access to the created Store |
managers | const std::vector<core::UserWithPubKey> & | vector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store |
publicMeta | const core::Buffer & | public (unencrypted) metadata |
privateMeta | const core::Buffer & | private (encrypted) metadata |
version | const int64_t | current version of the updated Store |
force | const bool | force update (without checking version) |
forceGenerateNewKey | const bool | force to regenerate a key for the Store |
policies | const std::optional<core::ContainerPolicy> & | Store policies |
deleteStore
Deletes a Store by given Store ID.
void deleteStore(
const std::string &storeId
)
Name | Type | Description |
---|
storeId | const std::string & | ID of the Store to delete |
getStore
Gets a single Store by given Store ID.
Store getStore(
const std::string &storeId
)
Name | Type | Description |
---|
storeId | const std::string & | ID of the Store to get |
Type | Description |
---|
Store | struct containing information about the Store |
listStores
Gets a list of Stores in given Context.
core::PagingList< Store > listStores(
const std::string &contextId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|
contextId | const std::string & | ID of the Context to get the Stores from |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
createFile
Creates a new file in a Store
int64_t createFile(
const std::string &storeId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t size
)
Name | Type | Description |
---|
storeId | const std::string & | ID of the Store to create the file in |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
size | const int64_t | size of the file |
Type | Description |
---|
int64_t | handle to write data |
updateFile
Update an existing file in a Store
int64_t updateFile(
const std::string &fileId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const int64_t size
)
Name | Type | Description |
---|
fileId | const std::string & | ID of the file to update |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
size | const int64_t | size of the file |
Type | Description |
---|
int64_t | handle to write file data |
Update metadata of an existing file in a Store
void updateFileMeta(
const std::string &fileId
const core::Buffer &publicMeta
const core::Buffer &privateMeta
)
Name | Type | Description |
---|
fileId | const std::string & | ID of the file to update |
publicMeta | const core::Buffer & | public file metadata |
privateMeta | const core::Buffer & | private file metadata |
writeToFile
Writes a file data.
void writeToFile(
const int64_t fileHandle
const core::Buffer &dataChunk
)
Name | Type | Description |
---|
fileHandle | const int64_t | |
dataChunk | const core::Buffer & | file data chunk |
deleteFile
Deletes a file by given ID.
void deleteFile(
const std::string &fileId
)
Name | Type | Description |
---|
fileId | const std::string & | ID of the file to delete |
getFile
Gets a single file by the given file ID.
File getFile(
const std::string &fileId
)
Name | Type | Description |
---|
fileId | const std::string & | ID of the file to get |
Type | Description |
---|
File | struct containing information about the file |
listFiles
Gets a list of files in given Store
core::PagingList< File > listFiles(
const std::string &storeId
const core::PagingQuery &pagingQuery
)
Name | Type | Description |
---|
storeId | const std::string & | |
pagingQuery | const core::PagingQuery & | struct with list query parameters |
openFile
Opens a file to read.
int64_t openFile(
const std::string &fileId
)
Name | Type | Description |
---|
fileId | const std::string & | ID of the file to read |
Type | Description |
---|
int64_t | handle to read file data |
readFromFile
Reads file data. Single read call moves the files's cursor position by declared length or set it at the end of the file.
core::Buffer readFromFile(
const int64_t fileHandle
const int64_t length
)
Name | Type | Description |
---|
fileHandle | const int64_t | |
length | const int64_t | size of data to read |
Type | Description |
---|
Buffer | buffer with file data chunk |
seekInFile
Moves read cursor.
void seekInFile(
const int64_t fileHandle
const int64_t position
)
Name | Type | Description |
---|
fileHandle | const int64_t | |
position | const int64_t | new cursor position |
closeFile
Closes the file handle.
std::string closeFile(
const int64_t fileHandle
)
Name | Type | Description |
---|
fileHandle | const int64_t | |
Type | Description |
---|
std::string | ID of closed file |
subscribeForStoreEvents
Subscribes for the Store module main events.
void subscribeForStoreEvents()
unsubscribeFromStoreEvents
Unsubscribes from the Store module main events.
void unsubscribeFromStoreEvents()
subscribeForFileEvents
Subscribes for events in given Store
void subscribeForFileEvents(
const std::string &storeId
)
Name | Type | Description |
---|
storeId | const std::string & | |
unsubscribeFromFileEvents
Unsubscribes from events in given Store
void unsubscribeFromFileEvents(
const std::string &storeId
)
Name | Type | Description |
---|
storeId | const std::string & | |