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

subscribeFor

Subscribe for the KVDB events on the given subscription query.

Params

subscriptionQueries

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

list of queries

std::vector< std::string > subscribeFor(
const std::vector<std::string> &subscriptionQueries
)

Returns

std::vector<std::string> · list of subscriptionIds in maching order to subscriptionQueries

unsubscribeFrom

Unsubscribe from events for the given subscriptionId.

Params

subscriptionIds

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

list of subscriptionId

void unsubscribeFrom(
const std::vector<std::string> &subscriptionIds
)

buildSubscriptionQuery

Generate subscription Query for the KVDB events.

Params

eventType

EventType

type of event which you listen for

selectorType

EventSelectorType

scope on which you listen for events

selectorId

const std::string &

ID of the selector

std::string buildSubscriptionQuery(
EventType eventType
EventSelectorType selectorType
const std::string &selectorId
)

Returns

std::string ·

buildSubscriptionQueryForSelectedEntry

Generate subscription Query for the KVDB events for single KvdbEntry.

Params

eventType

EventType

type of event which you listen for

kvdbId

const std::string &

Id of Kvdb

kvdbEntryKey

const std::string &

std::string buildSubscriptionQueryForSelectedEntry(
EventType eventType
const std::string &kvdbId
const std::string &kvdbEntryKey
)

Returns

std::string ·

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.