PrivMX DOCS
API Reference/Endpoint/Kvdb

KvdbApi

'KvdbApi' is a class representing Endpoint's API for Kvdbs and their messages.

Static Methods

create

Creates an instance of 'KvdbApi'.

Params

connetion

core::Connection &

static KvdbApi create(
core::Connection &connetion
)

Returns

KvdbApi · KvdbApi object

Methods

createKvdb

Creates a new KVDB in given Context.

Params

contextId

const std::string &

ID of the Context to create the KVDB in

users

const std::vector<core::UserWithPubKey> &

array of UserWithPubKey structs which indicates who will have access to the created KVDB

managers

const std::vector<core::UserWithPubKey> &

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created KVDB

publicMeta

const core::Buffer &

public (unencrypted) metadata

privateMeta

const core::Buffer &

private (encrypted) metadata

policies

const std::optional<core::ContainerPolicy> &

KVDB's policies

std::string createKvdb(
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
)

Returns

std::string · ID of the created KVDB

updateKvdb

Updates an existing KVDB.

Params

kvdbId

const std::string &

ID of the KVDB to update

users

const std::vector<core::UserWithPubKey> &

array of UserWithPubKey structs which indicates who will have access to the created KVDB

managers

const std::vector<core::UserWithPubKey> &

array of UserWithPubKey structs which indicates who will have access (and management rights) to the created KVDB

publicMeta

const core::Buffer &

public (unencrypted) metadata

privateMeta

const core::Buffer &

private (encrypted) metadata

version

const int64_t

current version of the updated KVDB

force

const bool

force update (without checking version)

forceGenerateNewKey

const bool

force to regenerate a key for the KVDB

policies

const std::optional<core::ContainerPolicy> &

KVDB's policies

void updateKvdb(
const std::string &kvdbId
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
)

deleteKvdb

Deletes a KVDB by given KVDB ID.

Params

kvdbId

const std::string &

ID of the KVDB to delete

void deleteKvdb(
const std::string &kvdbId
)

getKvdb

Gets a KVDB by given KVDB ID.

Params

kvdbId

const std::string &

ID of KVDB to get

Kvdb getKvdb(
const std::string &kvdbId
)

Returns

Kvdb · struct containing info about the KVDB

listKvdbs

Gets a list of Kvdbs in given Context.

Params

contextId

const std::string &

ID of the Context to get the Kvdbs from

pagingQuery

const core::PagingQuery &

with list query parameters

core::PagingList< Kvdb > listKvdbs(
const std::string &contextId
const core::PagingQuery &pagingQuery
)

Returns

core::PagingList<Kvdb> · struct containing a list of Kvdbs

getEntry

Gets a KVDB entry by given KVDB entry key and KVDB ID.

Params

kvdbId

const std::string &

KVDB ID of the KVDB entry to get

key

const std::string &

key of the KVDB entry to get

KvdbEntry getEntry(
const std::string &kvdbId
const std::string &key
)

Returns

KvdbEntry · struct containing the KVDB entry

hasEntry

Check whether the KVDB entry exists.

Params

kvdbId

const std::string &

KVDB ID of the KVDB entry to check

key

const std::string &

key of the KVDB entry to check

bool hasEntry(
const std::string &kvdbId
const std::string &key
)

Returns

bool · 'true' if the KVDB has an entry with given key, 'false' otherwise

listEntriesKeys

Gets a list of KVDB entries keys from a KVDB.

Params

kvdbId

const std::string &

ID of the KVDB to list KVDB entries from

pagingQuery

const core::PagingQuery &

with list query parameters

core::PagingList< std::string > listEntriesKeys(
const std::string &kvdbId
const core::PagingQuery &pagingQuery
)

Returns

core::PagingList<std::string> · struct containing a list of KVDB entries

listEntries

Gets a list of KVDB entries from a KVDB.

Params

kvdbId

const std::string &

ID of the KVDB to list KVDB entries from

pagingQuery

const core::PagingQuery &

with list query parameters

core::PagingList< KvdbEntry > listEntries(
const std::string &kvdbId
const core::PagingQuery &pagingQuery
)

Returns

core::PagingList<KvdbEntry> · struct containing a list of KVDB entries

setEntry

Sets a KVDB entry in the given KVDB.

Params

kvdbId

const std::string &

ID of the KVDB to set the entry to

key

const std::string &

KVDB entry key

publicMeta

const core::Buffer &

public KVDB entry metadata

privateMeta

const core::Buffer &

private KVDB entry metadata

data

const core::Buffer &

content of the KVDB entry

version

int64_t

void setEntry(
const std::string &kvdbId
const std::string &key
const core::Buffer &publicMeta
const core::Buffer &privateMeta
const core::Buffer &data
int64_t version=0
)

deleteEntry

Deletes a KVDB entry by given KVDB entry ID.

Params

kvdbId

const std::string &

KVDB ID of the KVDB entry to delete

key

const std::string &

key of the KVDB entry to delete

void deleteEntry(
const std::string &kvdbId
const std::string &key
)

deleteEntries

Deletes KVDB entries by given KVDB IDs and the list of entry keys.

Params

kvdbId

const std::string &

ID of the KVDB database to delete from

keys

const std::vector<std::string> &

vector of the keys of the KVDB entries to delete

std::map< std::string, bool > deleteEntries(
const std::string &kvdbId
const std::vector<std::string> &keys
)

Returns

std::map<std::string,bool> · map with the statuses of deletion for every key

subscribeForKvdbEvents

Subscribes for the KVDB module main events.

void subscribeForKvdbEvents()

unsubscribeFromKvdbEvents

Unsubscribes from the KVDB module main events.

void unsubscribeFromKvdbEvents()

subscribeForEntryEvents

Subscribes for events in given KVDB.

Params

kvdbId

std::string

void subscribeForEntryEvents(
std::string kvdbId
)

unsubscribeFromEntryEvents

Unsubscribes from events in given KVDB.

Params

kvdbId

std::string

void unsubscribeFromEntryEvents(
std::string kvdbId
)

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.