[#1213] deleteSvc: Do not allow to delete EC chunks
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
dc6778f385
commit
dc2867682f
1 changed files with 6 additions and 1 deletions
|
@ -17,6 +17,8 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errDeleteECChunk = errors.New("invalid operation: delete EC object chunk")
|
||||||
|
|
||||||
type execCtx struct {
|
type execCtx struct {
|
||||||
svc *Service
|
svc *Service
|
||||||
|
|
||||||
|
@ -66,13 +68,16 @@ func (exec *execCtx) newAddress(id oid.ID) oid.Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (exec *execCtx) formExtendedInfo(ctx context.Context) error {
|
func (exec *execCtx) formExtendedInfo(ctx context.Context) error {
|
||||||
_, err := exec.svc.header.head(ctx, exec)
|
obj, err := exec.svc.header.head(ctx, exec)
|
||||||
|
|
||||||
var errSplitInfo *objectSDK.SplitInfoError
|
var errSplitInfo *objectSDK.SplitInfoError
|
||||||
var errECInfo *objectSDK.ECInfoError
|
var errECInfo *objectSDK.ECInfoError
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case err == nil:
|
case err == nil:
|
||||||
|
if ech := obj.ECHeader(); ech != nil {
|
||||||
|
return errDeleteECChunk
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
case errors.As(err, &errSplitInfo):
|
case errors.As(err, &errSplitInfo):
|
||||||
exec.splitInfo = errSplitInfo.SplitInfo()
|
exec.splitInfo = errSplitInfo.SplitInfo()
|
||||||
|
|
Loading…
Reference in a new issue