PrivMX Endpoint v2.7.0
Loading...
Searching...
No Matches
privmx::endpoint::store::StoreApi Class Reference

#include <privmx/endpoint/store/StoreApi.hpp>

Inheritance diagram for privmx::endpoint::store::StoreApi:
Collaboration diagram for privmx::endpoint::store::StoreApi:

Public Member Functions

 StoreApi ()
 StoreApi (const StoreApi &obj)
StoreApioperator= (const StoreApi &obj)
 StoreApi (StoreApi &&obj)
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)
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)
void deleteStore (const std::string &storeId)
Store getStore (const std::string &storeId)
core::PagingList< StorelistStores (const std::string &contextId, const core::PagingQuery &pagingQuery)
int64_t createFile (const std::string &storeId, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t size, bool randomWriteSupport=false)
int64_t updateFile (const std::string &fileId, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t size)
void updateFileMeta (const std::string &fileId, const core::Buffer &publicMeta, const core::Buffer &privateMeta)
void writeToFile (const int64_t fileHandle, const core::Buffer &dataChunk, bool truncate=false)
void deleteFile (const std::string &fileId)
File getFile (const std::string &fileId)
core::PagingList< FilelistFiles (const std::string &storeId, const core::PagingQuery &pagingQuery)
int64_t openFile (const std::string &fileId)
core::Buffer readFromFile (const int64_t fileHandle, const int64_t length)
void seekInFile (const int64_t fileHandle, const int64_t position)
std::string closeFile (const int64_t fileHandle)
std::vector< std::string > subscribeFor (const std::vector< std::string > &subscriptionQueries)
void unsubscribeFrom (const std::vector< std::string > &subscriptionIds)
std::string buildSubscriptionQuery (EventType eventType, EventSelectorType selectorType, const std::string &selectorId)
void syncFile (const int64_t fileHandle)
Public Member Functions inherited from privmx::endpoint::core::ExtendedPointer< StoreApiImpl >
ExtendedPointer & operator= (const ExtendedPointer &obj)
std::shared_ptr< StoreApiImpl > getImpl () const

Static Public Member Functions

static StoreApi create (core::Connection &connection)

Additional Inherited Members

Protected Member Functions inherited from privmx::endpoint::core::ExtendedPointer< StoreApiImpl >
void attachToPtrIfPossible ()
void detachFromPtrIfPossible ()
Protected Attributes inherited from privmx::endpoint::core::ExtendedPointer< StoreApiImpl >
std::weak_ptr< StoreApiImpl > _ptr

Detailed Description

'StoreApi' is a class representing Endpoint's API for Stores and their files.

Constructor & Destructor Documentation

◆ StoreApi()

privmx::endpoint::store::StoreApi::StoreApi ( )

//doc-gen:ignore

Member Function Documentation

◆ buildSubscriptionQuery()

std::string privmx::endpoint::store::StoreApi::buildSubscriptionQuery ( EventType eventType,
EventSelectorType selectorType,
const std::string & selectorId )

Generate subscription Query for the Store events.

Parameters
eventTypetype of event which you listen for
selectorTypescope on which you listen for events
selectorIdID of the selector

◆ closeFile()

std::string privmx::endpoint::store::StoreApi::closeFile ( const int64_t fileHandle)

Closes the file handle.

Parameters
handlehandle to read/write file data
Returns
ID of closed file

◆ create()

StoreApi privmx::endpoint::store::StoreApi::create ( core::Connection & connection)
static

Creates an instance of 'StoreApi'.

Parameters
connectioninstance of 'Connection'
Returns
StoreApi object

◆ createFile()

int64_t privmx::endpoint::store::StoreApi::createFile ( const std::string & storeId,
const core::Buffer & publicMeta,
const core::Buffer & privateMeta,
const int64_t size,
bool randomWriteSupport = false )

Creates a new file in a Store.

Parameters
storeIdID of the Store to create the file in
publicMetapublic file metadata
privateMetaprivate file metadata
sizesize of the file
randomWriteSupportenable random write support for file
Returns
handle to write data

◆ createStore()

std::string privmx::endpoint::store::StoreApi::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 )

Creates a new Store in given Context.

Parameters
contextIdID of the Context to create the Store in
usersvector of UserWithPubKey structs which indicates who will have access to the created Store
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
policiesStore's policies
Returns
created Store ID

◆ deleteFile()

void privmx::endpoint::store::StoreApi::deleteFile ( const std::string & fileId)

Deletes a file by given ID.

Parameters
fileIdID of the file to delete

◆ deleteStore()

void privmx::endpoint::store::StoreApi::deleteStore ( const std::string & storeId)

Deletes a Store by given Store ID.

Parameters
storeIdID of the Store to delete

◆ getFile()

File privmx::endpoint::store::StoreApi::getFile ( const std::string & fileId)

Gets a single file by the given file ID.

Parameters
fileIdID of the file to get
Returns
struct containing information about the file

◆ getStore()

Store privmx::endpoint::store::StoreApi::getStore ( const std::string & storeId)

Gets a single Store by given Store ID.

Parameters
storeIdID of the Store to get
Returns
struct containing information about the Store

◆ listFiles()

core::PagingList< File > privmx::endpoint::store::StoreApi::listFiles ( const std::string & storeId,
const core::PagingQuery & pagingQuery )

Gets a list of files in given Store.

Parameters
storeID of the Store to get files from
pagingQuerystruct with list query parameters
Returns
struct containing list of files

◆ listStores()

core::PagingList< Store > privmx::endpoint::store::StoreApi::listStores ( const std::string & contextId,
const core::PagingQuery & pagingQuery )

Gets a list of Stores in given Context.

Parameters
contextIdID of the Context to get the Stores from
pagingQuerystruct with list query parameters
Returns
struct containing list of Stores

◆ openFile()

int64_t privmx::endpoint::store::StoreApi::openFile ( const std::string & fileId)

Opens a file to read.

Parameters
fileIdID of the file to read
Returns
handle to read file data

◆ readFromFile()

core::Buffer privmx::endpoint::store::StoreApi::readFromFile ( const int64_t fileHandle,
const int64_t length )

Reads file data. Single read call moves the files's cursor position by declared length or set it at the end of the file.

Parameters
handlehandle to write file data
lengthsize of data to read
Returns
buffer with file data chunk

◆ seekInFile()

void privmx::endpoint::store::StoreApi::seekInFile ( const int64_t fileHandle,
const int64_t position )

Moves read cursor.

Parameters
handlehandle to write file data
positionnew cursor position

◆ subscribeFor()

std::vector< std::string > privmx::endpoint::store::StoreApi::subscribeFor ( const std::vector< std::string > & subscriptionQueries)

Subscribe for the Store events on the given subscription query.

Parameters
subscriptionQuerieslist of queries
Returns
list of subscriptionIds in maching order to subscriptionQueries

◆ syncFile()

void privmx::endpoint::store::StoreApi::syncFile ( const int64_t fileHandle)

Synchronize file handle data with newest data on server

Parameters
fileHandlehandle to read/write file data

◆ unsubscribeFrom()

void privmx::endpoint::store::StoreApi::unsubscribeFrom ( const std::vector< std::string > & subscriptionIds)

Unsubscribe from events for the given subscriptionId.

Parameters
subscriptionIdslist of subscriptionId

◆ updateFile()

int64_t privmx::endpoint::store::StoreApi::updateFile ( const std::string & fileId,
const core::Buffer & publicMeta,
const core::Buffer & privateMeta,
const int64_t size )

Update an existing file in a Store.

Parameters
fileIdID of the file to update
publicMetapublic file metadata
privateMetaprivate file metadata
sizesize of the file
Returns
handle to write file data

◆ updateFileMeta()

void privmx::endpoint::store::StoreApi::updateFileMeta ( const std::string & fileId,
const core::Buffer & publicMeta,
const core::Buffer & privateMeta )

Update metadata of an existing file in a Store.

Parameters
fileIdID of the file to update
publicMetapublic file metadata
privateMetaprivate file metadata

◆ updateStore()

void privmx::endpoint::store::StoreApi::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 )

Updates an existing Store.

Parameters
storeIdID of the Store to update
usersvector of UserWithPubKey structs which indicates who will have access to the created Store
managersvector of UserWithPubKey structs which indicates who will have access (and management rights) to the created Store
publicMetapublic (unencrypted) metadata
privateMetaprivate (encrypted) metadata
versioncurrent version of the updated Store
forceforce update (without checking version)
forceGenerateNewKeyforce to regenerate a key for the Store
policiesStore's policies

◆ writeToFile()

void privmx::endpoint::store::StoreApi::writeToFile ( const int64_t fileHandle,
const core::Buffer & dataChunk,
bool truncate = false )

Writes a file data.

Parameters
handlehandle to write file data
dataChunkfile data chunk
truncatetruncate the file from: current pos + dataChunk size

The documentation for this class was generated from the following file: