forked from TrueCloudLab/frostfs-node
[#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
|
@ -101,19 +101,12 @@ type localObjectInhumer struct {
|
|||
log *logger.Logger
|
||||
}
|
||||
|
||||
func (r *localObjectInhumer) DeleteObjects(ts *addressSDK.Address, addr ...*addressSDK.Address) {
|
||||
func (r *localObjectInhumer) DeleteObjects(ts *addressSDK.Address, addr ...*addressSDK.Address) error {
|
||||
prm := new(engine.InhumePrm)
|
||||
prm.WithTarget(ts, addr...)
|
||||
|
||||
for _, a := range addr {
|
||||
prm.WithTarget(ts, a)
|
||||
|
||||
if _, err := r.storage.Inhume(prm); err != nil {
|
||||
r.log.Error("could not delete object",
|
||||
zap.Stringer("address", a),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
}
|
||||
}
|
||||
_, err := r.storage.Inhume(prm)
|
||||
return err
|
||||
}
|
||||
|
||||
type delNetInfo struct {
|
||||
|
@ -267,6 +260,7 @@ func initObjectService(c *cfg) {
|
|||
putsvc.WithNetmapKeys(c),
|
||||
putsvc.WithFormatValidatorOpts(
|
||||
objectCore.WithDeleteHandler(objInhumer),
|
||||
objectCore.WithLocker(ls),
|
||||
),
|
||||
putsvc.WithNetworkState(c.cfgNetmap.state),
|
||||
putsvc.WithWorkerPools(c.cfgObject.pool.putRemote),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue