Skip to main content
reference

StoreApi

Manages PrivMX Bridge Stores and Files.

Constructors

StoreApi

Initialize Store module on passed active connection.

public void StoreApi(
Connection connection
)

NameTypeDescription
connectionConnectionactive connection to PrivMX Bridge

Methods

close

Frees memory.

public void close()

closeFile

Closes the file handle.

public String closeFile(
long fileHandle
)

NameTypeDescription
fileHandlelonghandle to read/write file data

TypeDescription
String ID of closed file

createFile

Creates a new file in a Store.

public Long createFile(
String storeId,
byte[] publicMeta,
byte[] privateMeta,
long size
)

NameTypeDescription
storeIdStringID of the Store to create the file in
publicMetabyte[]public file metadata
privateMetabyte[]private file metadata
sizelongsize of the file

TypeDescription
Long Handle to write data

createStore

Creates a new Store in given Context.

public String createStore(
String contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta
)

NameTypeDescription
contextIdStringID of the Context to create the Store in
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the created Store
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the created Store
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata

TypeDescription
String Created Store ID

deleteFile

Deletes a file by given ID.

public void deleteFile(
String fileId
)

NameTypeDescription
fileIdStringID of the file to delete

deleteStore

Deletes a Store by given Store ID.

public void deleteStore(
String storeId
)

NameTypeDescription
storeIdStringID of the Store to delete

getFile

Gets a single file by the given file ID.

public File getFile(
String fileId
)

NameTypeDescription
fileIdStringID of the file to get

TypeDescription
File Information about the file

getStore

Gets a single Store by given Store ID.

public Store getStore(
String storeId
)

NameTypeDescription
storeIdStringID of the Store to get

TypeDescription
Store Information about the Store

listFiles

Gets a list of files in given Store.

public PagingList<File> listFiles(
String storeId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
storeIdStringID of the Store to get files from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<File> list of files

listFiles

Gets a list of files in given Store.

public PagingList<File> listFiles(
String storeId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
storeIdStringID of the Store to get files from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<File> list of files

listStores

Gets a list of Stores in given Context.

public PagingList<Store> listStores(
String contextId,
long skip,
long limit,
String sortOrder
)

NameTypeDescription
contextIdStringID of the Context to get the Stores from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)

TypeDescription
PagingList<Store> list of Stores

listStores

Gets a list of Stores in given Context.

public PagingList<Store> listStores(
String contextId,
long skip,
long limit,
String sortOrder,
String lastId
)

NameTypeDescription
contextIdStringID of the Context to get the Stores from
skiplongskip number of elements to skip from result
limitlonglimit of elements to return for query
sortOrderStringorder of elements in result ("asc" for ascending, "desc" for descending)
lastIdStringID of the element from which query results should start

TypeDescription
PagingList<Store> list of Stores

openFile

Opens a file to read.

public Long openFile(
String fileId
)

NameTypeDescription
fileIdStringID of the file to read

TypeDescription
Long Handle to read file data

readFromFile

Reads file data.

public byte[] readFromFile(
long fileHandle,
long length
)

NameTypeDescription
fileHandlelonghandle to read file data
lengthlongsize of data to read

TypeDescription
byte[] File data chunk

seekInFile

Moves read cursor.

public void seekInFile(
long fileHandle,
long position
)

NameTypeDescription
fileHandlelonghandle to read/write file data
positionlongnew cursor position

subscribeForFileEvents

Subscribes for events in given Store.

public void subscribeForFileEvents(
String storeId
)

NameTypeDescription
storeIdStringID of the Store to subscribe

subscribeForStoreEvents

Subscribes for the Store module main events.

public void subscribeForStoreEvents()

unsubscribeFromFileEvents

Unsubscribes from events in given Store.

public void unsubscribeFromFileEvents(
String storeId
)

NameTypeDescription
storeIdStringID of the `Store` to unsubscribe

unsubscribeFromStoreEvents

Unsubscribes from the Store module main events.

public void unsubscribeFromStoreEvents()

updateFile

Updates an existing file in a Store.

public Long updateFile(
String fileId,
byte[] publicMeta,
byte[] privateMeta,
long size
)

NameTypeDescription
fileIdStringID of the file to update
publicMetabyte[]public file metadata
privateMetabyte[]private file metadata
sizelongsize of the file

TypeDescription
Long Handle to write file data

updateFileMeta

Updates metadata of an existing file in a Store.

public void updateFileMeta(
String fileId,
byte[] publicMeta,
byte[] privateMeta
)

NameTypeDescription
fileIdStringID of the file to update
publicMetabyte[]public file metadata
privateMetabyte[]private file metadata

updateStore

Updates an existing Store.

public void updateStore(
String storeId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
boolean force
)

NameTypeDescription
storeIdStringID of the Store to update
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the updated Store
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the updated Store
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
versionlongcurrent version of the updated Store
forcebooleanforce update (without checking version)

updateStore

Updates an existing Store.

public void updateStore(
String storeId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
long version,
boolean force,
boolean forceGenerateNewKey
)

NameTypeDescription
storeIdStringID of the Store to update
usersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access to the updated Store
managersList<UserWithPubKey>list of UserWithPubKey which indicates who will have access (and management rights) to the updated Store
publicMetabyte[]public (unencrypted) metadata
privateMetabyte[]private (encrypted) metadata
versionlongcurrent version of the updated Store
forcebooleanforce update (without checking version)
forceGenerateNewKeybooleanforce to regenerate a key for the Store

writeToFile

Writes a file data.

public void writeToFile(
long fileHandle,
byte[] dataChunk
)

NameTypeDescription
fileHandlelonghandle to write file data
dataChunkbyte[]file data chunk