6.1 Lock/Unlock File
6.1.1 Lock File
T he lockFile
method of BayunCore
class locks a file with default encryption-policy
and key-generation-policy
dictated by server settings.
Parameters
filePath : Path of the file to be locked.
success : Success block to be executed after file is successfully locked.
failure : Failure block to be executed if locking fails, returns
BayunError
.
The file at the given file path is overwritten with the locked file. If file locking fails original file is not changed.
6.1.2 Lock File with Encryption Policy, Key Generation Policy
The lockFile
method with encryption policy, key generation policy as parameters locks file with the encryption key dictated by the policy.
Parameters
filePath : Path of the file to be locked.
encryptionPolicy : BayunEncryptionPolicy determines the key for locking.
keyGenerationPolicy : BayunKeyGenerationPolicy determines the policy to generate the data encryption key.
groupId : GroupId is required if encryptionPolicy is
BayunEncryptionPolicyGroup
.success : Success block to be executed after file is successfully locked.
failure : Failure block to be executed if locking fails, returns
BayunError
.
If encryption-policy is other than BayunEncryptionPolicyGroup
then groupId should be null.
6.1.3 Unlock File
The unlockFile
method of BayunCore
class unlocks a locked file.
Parameters
filePath : Path of the file to be unlocked.
success : Success block to be executed after file is successfully unlocked.
failure : Failure block to be executed if unlocking fails, returns
BayunError
.
Last updated