public final class MData
extends java.lang.Object
Constructor and Description |
---|
MData(net.maidsafe.api.AppHandle appHandle) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<byte[]> |
decrypt(MDataInfo mDataInfo,
byte[] value)
Decrypts an MData entry key/value
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteUserPermission(NativeHandle publicSignKey,
MDataInfo mDataInfo,
long version)
Deletes the permissions given to a particular user
|
java.util.concurrent.CompletableFuture<MDataInfo> |
deserialise(byte[] serialisedMData)
Deserialises Mutable Data info
|
java.util.concurrent.CompletableFuture<byte[]> |
encodeMetadata(MetadataResponse metadataResponse)
Serialises metadata of the Mutable data
|
java.util.concurrent.CompletableFuture<byte[]> |
encryptEntryKey(MDataInfo mDataInfo,
byte[] key)
Encrypts an MData entry key
|
java.util.concurrent.CompletableFuture<byte[]> |
encryptEntryValue(MDataInfo mDataInfo,
byte[] value)
Encrypts MData entry value
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getEntriesHandle(MDataInfo mDataInfo)
Gets Mutable Data entries handle
|
java.util.concurrent.CompletableFuture<java.util.List<MDataKey>> |
getKeys(MDataInfo mDataInfo)
Retrieves the list of keys in the Mutable Data
|
java.util.concurrent.CompletableFuture<NativeHandle> |
getPermission(MDataInfo mDataInfo)
Fetches the permissions handle for the Mutable Data
|
java.util.concurrent.CompletableFuture<PermissionSet> |
getPermissionForUser(NativeHandle publicSignKey,
MDataInfo mDataInfo)
Gets the permissions given for the user
|
java.util.concurrent.CompletableFuture<MDataInfo> |
getPrivateMData(byte[] name,
long typeTag,
byte[] secretKey,
byte[] nonce)
Creates a new Mutable data with the defined name and type tag
|
java.util.concurrent.CompletableFuture<MDataInfo> |
getRandomPrivateMData(long typeTag)
Generates private Mutable Data at a random XOR address
|
java.util.concurrent.CompletableFuture<MDataInfo> |
getRandomPublicMData(long typeTag)
Generates public Mutable Data at a random XOR address
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getSerialisedSize(MDataInfo mDataInfo)
Returns the size of the serialised Mutable Data info
|
java.util.concurrent.CompletableFuture<MDataValue> |
getValue(MDataInfo mDataInfo,
byte[] key)
Returns the value for the entry for the given key
|
java.util.concurrent.CompletableFuture<java.util.List<MDataValue>> |
getValues(MDataInfo mDataInfo)
Retrieves the list of values in the Mutable data
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
getVersion(MDataInfo mDataInfo)
Returns the version of the Mutable Data shell
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
mutateEntries(MDataInfo mDataInfo,
NativeHandle actionHandle)
Mutates the existing Mutable Data on the network
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
put(MDataInfo mDataInfo,
NativeHandle permissionHandle,
NativeHandle entriesHandle)
Commit the Mutable data on the network
|
java.util.concurrent.CompletableFuture<byte[]> |
serialise(MDataInfo mDataInfo)
Serialises the Mutable data info as byte array
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
setUserPermission(NativeHandle publicSignKey,
MDataInfo mDataInfo,
PermissionSet permissionSet,
long version)
Sets the permissions for a user
|
public java.util.concurrent.CompletableFuture<MDataInfo> getPrivateMData(byte[] name, long typeTag, byte[] secretKey, byte[] nonce)
name
- Name(address) of the Mutable DatatypeTag
- Mutable data type tagsecretKey
- Secret key of the MData ownernonce
- A unique nonceMDataInfo
public java.util.concurrent.CompletableFuture<MDataInfo> getRandomPrivateMData(long typeTag)
typeTag
- MData type tagMDataInfo
instancepublic java.util.concurrent.CompletableFuture<MDataInfo> getRandomPublicMData(long typeTag)
typeTag
- MData type tagMDataInfo
instancepublic java.util.concurrent.CompletableFuture<byte[]> encryptEntryKey(MDataInfo mDataInfo, byte[] key)
mDataInfo
- Mutable data info as MDataInfo
key
- Key to be encrypted as byte arraypublic java.util.concurrent.CompletableFuture<byte[]> encryptEntryValue(MDataInfo mDataInfo, byte[] value)
mDataInfo
- Mutable data info as MDataInfo
value
- Value to be encrypted as byte arraypublic java.util.concurrent.CompletableFuture<byte[]> decrypt(MDataInfo mDataInfo, byte[] value)
mDataInfo
- Mutable data info as MDataInfo
value
- Encrypted key/valuepublic java.util.concurrent.CompletableFuture<byte[]> serialise(MDataInfo mDataInfo)
public java.util.concurrent.CompletableFuture<MDataInfo> deserialise(byte[] serialisedMData)
serialisedMData
- Serialised mDataInfoMDataInfo
instancepublic java.util.concurrent.CompletableFuture<java.lang.Void> put(MDataInfo mDataInfo, NativeHandle permissionHandle, NativeHandle entriesHandle)
mDataInfo
- Mutable data info as MDataInfo
permissionHandle
- Permission handle as NativeHandle
.
To commit the data without permissions use Constants.MD_PERMISSION_EMPTYentriesHandle
- Entries handle as NativeHandle
.
To commit the data without entries use Constants.MD_ENTRIES_EMPTYpublic java.util.concurrent.CompletableFuture<java.lang.Long> getVersion(MDataInfo mDataInfo)
mDataInfo
- Mutable data info as MDataInfo
public java.util.concurrent.CompletableFuture<java.lang.Long> getSerialisedSize(MDataInfo mDataInfo)
mDataInfo
- Mutable data info as MDataInfo
public java.util.concurrent.CompletableFuture<MDataValue> getValue(MDataInfo mDataInfo, byte[] key)
mDataInfo
- Mutable data info as MDataInfo
key
- Key of the Mutable Data entryMDataValue
public java.util.concurrent.CompletableFuture<NativeHandle> getEntriesHandle(MDataInfo mDataInfo)
mDataInfo
- Mutable data info as MDataInfo
NativeHandle
instancepublic java.util.concurrent.CompletableFuture<java.util.List<MDataKey>> getKeys(MDataInfo mDataInfo)
public java.util.concurrent.CompletableFuture<java.util.List<MDataValue>> getValues(MDataInfo mDataInfo)
mDataInfo
- Mutable data info as MDataInfo
MDataValue
>public java.util.concurrent.CompletableFuture<java.lang.Void> mutateEntries(MDataInfo mDataInfo, NativeHandle actionHandle)
mDataInfo
- Mutable Data info as MDataInfo
actionHandle
- Mutable Data actions handlepublic java.util.concurrent.CompletableFuture<NativeHandle> getPermission(MDataInfo mDataInfo)
mDataInfo
- Mutable Data info as MDataInfo
NativeHandle
instancepublic java.util.concurrent.CompletableFuture<PermissionSet> getPermissionForUser(NativeHandle publicSignKey, MDataInfo mDataInfo)
publicSignKey
- Public sign key of the usermDataInfo
- Mutable data info as MDataInfo
PermissionSet
instancepublic java.util.concurrent.CompletableFuture<java.lang.Void> setUserPermission(NativeHandle publicSignKey, MDataInfo mDataInfo, PermissionSet permissionSet, long version)
publicSignKey
- Public sign key of the user as NativeHandle
mDataInfo
- Mutable data info as MDataInfo
permissionSet
- PermissionSet
for the userversion
- The next version of the Mutable Data shellpublic java.util.concurrent.CompletableFuture<java.lang.Void> deleteUserPermission(NativeHandle publicSignKey, MDataInfo mDataInfo, long version)
publicSignKey
- Public sign key of the user as NativeHandle
mDataInfo
- Mutable data info as MDataInfo
version
- The next version of the Mutable Data shellpublic java.util.concurrent.CompletableFuture<byte[]> encodeMetadata(MetadataResponse metadataResponse)
metadataResponse
- Metadata of the Mutable data as MetadataResponse