[#1175] object/fmt: Handle LOCK
objects
Make `FormatValidator.ValidateContent` to verify payload of `LOCK` objects. Pass locked objects to `Locker` interface. Require from `Locker.Lock` to return `apistatus.IrregularObjectLock` error on a corresponding condition. Also add error return to `DeleteHandler.DeleteObjects` method. Require from method to return `apistatus.ObjectLocked` error on a corresponding condition. Adopt implementations. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
d163008b63
commit
ced854bc2e
5 changed files with 63 additions and 18 deletions
|
@ -32,11 +32,11 @@ func (e *StorageEngine) lock(idCnr cid.ID, locker oid.ID, locked []oid.ID) error
|
|||
for i := range locked {
|
||||
switch e.lockSingle(idCnr, locker, locked[i], true) {
|
||||
case 1:
|
||||
return apistatus.IrregularObjectLock{}
|
||||
return apistatus.LockNonRegularObject{}
|
||||
case 0:
|
||||
switch e.lockSingle(idCnr, locker, locked[i], false) {
|
||||
case 1:
|
||||
return apistatus.IrregularObjectLock{}
|
||||
return apistatus.LockNonRegularObject{}
|
||||
case 0:
|
||||
return errLockFailed
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func (e *StorageEngine) lock(idCnr cid.ID, locker oid.ID, locked []oid.ID) error
|
|||
func (e *StorageEngine) lockSingle(idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) {
|
||||
// code is pretty similar to inhumeAddr, maybe unify?
|
||||
root := false
|
||||
var errIrregular apistatus.IrregularObjectLock
|
||||
var errIrregular apistatus.LockNonRegularObject
|
||||
|
||||
var addrLocked address.Address
|
||||
addrLocked.SetContainerID(&idCnr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue