[#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:
Leonard Lyubich 2022-02-16 18:49:19 +03:00 committed by LeL
parent d163008b63
commit ced854bc2e
5 changed files with 63 additions and 18 deletions

View file

@ -42,7 +42,7 @@ func (db *DB) Lock(cnr cid.ID, locker oid.ID, locked []oid.ID) error {
}
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != object.TypeRegular {
return apistatus.IrregularObjectLock{}
return apistatus.LockNonRegularObject{}
}
bucketLocked, err := tx.CreateBucketIfNotExists(bucketNameLocked)