StoreApi
Manages PrivMX Bridge Stores and Files.
Constructors
StoreApi
Initialize Store module on passed active connection.
public void StoreApi(
Connection connection
)
Name | Type | Description |
---|
connection | Connection | active connection to PrivMX Bridge |
Methods
close
Frees memory.
closeFile
Closes the file handle.
public String closeFile(
long fileHandle
)
Name | Type | Description |
---|
fileHandle | long | handle to read/write file data |
Type | Description |
---|
String | ID of closed file |
createFile
Creates a new file in a Store.
public Long createFile(
String storeId,
byte[] publicMeta,
byte[] privateMeta,
long size
)
Name | Type | Description |
---|
storeId | String | ID of the Store to create the file in |
publicMeta | byte[] | public file metadata |
privateMeta | byte[] | private file metadata |
size | long | size of the file |
Type | Description |
---|
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
)
Name | Type | Description |
---|
contextId | String | ID of the Context to create the Store in |
users | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access to the created Store |
managers | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access (and management rights) to the
created Store |
publicMeta | byte[] | public (unencrypted) metadata |
privateMeta | byte[] | private (encrypted) metadata |
Type | Description |
---|
String | Created Store ID |
createStore
Creates a new Store in given Context.
public String createStore(
String contextId,
List<UserWithPubKey> users,
List<UserWithPubKey> managers,
byte[] publicMeta,
byte[] privateMeta,
ContainerPolicy policies
)
Name | Type | Description |
---|
contextId | String | ID of the Context to create the Store in |
users | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access to the created Store |
managers | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access (and management rights) to the
created Store |
publicMeta | byte[] | public (unencrypted) metadata |
privateMeta | byte[] | private (encrypted) metadata |
policies | ContainerPolicy | additional container access policies |
Type | Description |
---|
String | Created Store ID |
deleteFile
Deletes a file by given ID.
public void deleteFile(
String fileId
)
Name | Type | Description |
---|
fileId | String | ID of the file to delete |
deleteStore
Deletes a Store by given Store ID.
public void deleteStore(
String storeId
)
Name | Type | Description |
---|
storeId | String | ID of the Store to delete |
getFile
Gets a single file by the given file ID.
public File getFile(
String fileId
)
Name | Type | Description |
---|
fileId | String | ID of the file to get |
Type | Description |
---|
File | Information about the file |
getStore
Gets a single Store by given Store ID.
public Store getStore(
String storeId
)
Name | Type | Description |
---|
storeId | String | ID of the Store to get |
Type | Description |
---|
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
)
Name | Type | Description |
---|
storeId | String | ID of the Store to get files from |
skip | long | skip number of elements to skip from result |
limit | long | limit of elements to return for query |
sortOrder | String | order of elements in result ("asc" for ascending, "desc" for descending) |
Type | Description |
---|
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
)
Name | Type | Description |
---|
storeId | String | ID of the Store to get files from |
skip | long | skip number of elements to skip from result |
limit | long | limit of elements to return for query |
sortOrder | String | order of elements in result ("asc" for ascending, "desc" for descending) |
lastId | String | ID of the element from which query results should start |
Type | Description |
---|
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
)
Name | Type | Description |
---|
contextId | String | ID of the Context to get the Stores from |
skip | long | skip number of elements to skip from result |
limit | long | limit of elements to return for query |
sortOrder | String | order of elements in result ("asc" for ascending, "desc" for descending) |
Type | Description |
---|
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
)
Name | Type | Description |
---|
contextId | String | ID of the Context to get the Stores from |
skip | long | skip number of elements to skip from result |
limit | long | limit of elements to return for query |
sortOrder | String | order of elements in result ("asc" for ascending, "desc" for descending) |
lastId | String | ID of the element from which query results should start |
Type | Description |
---|
PagingList<Store> | list of Stores |
openFile
Opens a file to read.
public Long openFile(
String fileId
)
Name | Type | Description |
---|
fileId | String | ID of the file to read |
Type | Description |
---|
Long | Handle to read file data |
readFromFile
Reads file data.
public byte[] readFromFile(
long fileHandle,
long length
)
Name | Type | Description |
---|
fileHandle | long | handle to read file data |
length | long | size of data to read |
Type | Description |
---|
byte[] | File data chunk |
seekInFile
Moves read cursor.
public void seekInFile(
long fileHandle,
long position
)
Name | Type | Description |
---|
fileHandle | long | handle to read/write file data |
position | long | new cursor position |
subscribeForFileEvents
Subscribes for events in given Store.
public void subscribeForFileEvents(
String storeId
)
Name | Type | Description |
---|
storeId | String | ID 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
)
Name | Type | Description |
---|
storeId | String | ID 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
)
Name | Type | Description |
---|
fileId | String | ID of the file to update |
publicMeta | byte[] | public file metadata |
privateMeta | byte[] | private file metadata |
size | long | size of the file |
Type | Description |
---|
Long | Handle to write file data |
Updates metadata of an existing file in a Store.
public void updateFileMeta(
String fileId,
byte[] publicMeta,
byte[] privateMeta
)
Name | Type | Description |
---|
fileId | String | ID of the file to update |
publicMeta | byte[] | public file metadata |
privateMeta | byte[] | 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
)
Name | Type | Description |
---|
storeId | String | ID of the Store to update |
users | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access to the updated Store |
managers | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access (and management rights) to the
updated Store |
publicMeta | byte[] | public (unencrypted) metadata |
privateMeta | byte[] | private (encrypted) metadata |
version | long | current version of the updated Store |
force | boolean | force 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
)
Name | Type | Description |
---|
storeId | String | ID of the Store to update |
users | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access to the updated Store |
managers | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access (and management rights) to the
updated Store |
publicMeta | byte[] | public (unencrypted) metadata |
privateMeta | byte[] | private (encrypted) metadata |
version | long | current version of the updated Store |
force | boolean | force update (without checking version) |
forceGenerateNewKey | boolean | force to regenerate a key for the Store |
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,
ContainerPolicy policies
)
Name | Type | Description |
---|
storeId | String | ID of the Store to update |
users | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access to the updated Store |
managers | List<UserWithPubKey> | list of UserWithPubKey which indicates who will have access (and management rights) to the
updated Store |
publicMeta | byte[] | public (unencrypted) metadata |
privateMeta | byte[] | private (encrypted) metadata |
version | long | current version of the updated Store |
force | boolean | force update (without checking version) |
forceGenerateNewKey | boolean | force to regenerate a key for the Store |
policies | ContainerPolicy | additional container access policies |
writeToFile
Writes a file data.
public void writeToFile(
long fileHandle,
byte[] dataChunk
)
Name | Type | Description |
---|
fileHandle | long | handle to write file data |
dataChunk | byte[] | file data chunk |