[#1598] engine: Drop unnecessary result structs
All checks were successful
DCO action / DCO (pull_request) Successful in 31s
Tests and linters / Run gofumpt (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 54s
Build / Build Components (pull_request) Successful in 1m29s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Tests and linters / gopls check (pull_request) Successful in 2m15s
Tests and linters / Lint (pull_request) Successful in 2m41s
Tests and linters / Staticcheck (pull_request) Successful in 2m49s
Tests and linters / Tests (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 5m1s
Vulncheck / Vulncheck (push) Successful in 1m5s
Pre-commit hooks / Pre-commit (push) Successful in 1m19s
Build / Build Components (push) Successful in 1m36s
Tests and linters / gopls check (push) Successful in 2m16s
Tests and linters / Run gofumpt (push) Successful in 2m32s
Tests and linters / Staticcheck (push) Successful in 2m49s
Tests and linters / Lint (push) Successful in 3m10s
Tests and linters / Tests (push) Successful in 3m12s
Tests and linters / Tests with -race (push) Successful in 4m15s
All checks were successful
DCO action / DCO (pull_request) Successful in 31s
Tests and linters / Run gofumpt (pull_request) Successful in 29s
Vulncheck / Vulncheck (pull_request) Successful in 54s
Build / Build Components (pull_request) Successful in 1m29s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Tests and linters / gopls check (pull_request) Successful in 2m15s
Tests and linters / Lint (pull_request) Successful in 2m41s
Tests and linters / Staticcheck (pull_request) Successful in 2m49s
Tests and linters / Tests (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 5m1s
Vulncheck / Vulncheck (push) Successful in 1m5s
Pre-commit hooks / Pre-commit (push) Successful in 1m19s
Build / Build Components (push) Successful in 1m36s
Tests and linters / gopls check (push) Successful in 2m16s
Tests and linters / Run gofumpt (push) Successful in 2m32s
Tests and linters / Staticcheck (push) Successful in 2m49s
Tests and linters / Lint (push) Successful in 3m10s
Tests and linters / Tests (push) Successful in 3m12s
Tests and linters / Tests with -race (push) Successful in 4m15s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
fb928616cc
commit
eff95bd632
7 changed files with 36 additions and 59 deletions
|
@ -24,11 +24,6 @@ type DeletePrm struct {
|
|||
forceRemoval bool
|
||||
}
|
||||
|
||||
// DeleteRes groups the resulting values of Delete operation.
|
||||
type DeleteRes struct{}
|
||||
|
||||
var deleteRes = DeleteRes{}
|
||||
|
||||
// WithAddress is a Delete option to set the addresses of the objects to delete.
|
||||
//
|
||||
// Option is required.
|
||||
|
@ -53,7 +48,7 @@ func (p *DeletePrm) WithForceRemoval() {
|
|||
// NOTE: Marks any object to be deleted (despite any prohibitions
|
||||
// on operations with that object) if WithForceRemoval option has
|
||||
// been provided.
|
||||
func (e *StorageEngine) Delete(ctx context.Context, prm DeletePrm) (res DeleteRes, err error) {
|
||||
func (e *StorageEngine) Delete(ctx context.Context, prm DeletePrm) error {
|
||||
ctx, span := tracing.StartSpanFromContext(ctx, "StorageEngine.Delete",
|
||||
trace.WithAttributes(
|
||||
attribute.String("address", prm.addr.EncodeToString()),
|
||||
|
@ -62,15 +57,12 @@ func (e *StorageEngine) Delete(ctx context.Context, prm DeletePrm) (res DeleteRe
|
|||
defer span.End()
|
||||
defer elapsed("Delete", e.metrics.AddMethodDuration)()
|
||||
|
||||
err = e.execIfNotBlocked(func() error {
|
||||
res, err = e.delete(ctx, prm)
|
||||
return err
|
||||
return e.execIfNotBlocked(func() error {
|
||||
return e.delete(ctx, prm)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (e *StorageEngine) delete(ctx context.Context, prm DeletePrm) (DeleteRes, error) {
|
||||
func (e *StorageEngine) delete(ctx context.Context, prm DeletePrm) error {
|
||||
var locked struct {
|
||||
is bool
|
||||
}
|
||||
|
@ -128,14 +120,14 @@ func (e *StorageEngine) delete(ctx context.Context, prm DeletePrm) (DeleteRes, e
|
|||
})
|
||||
|
||||
if locked.is {
|
||||
return deleteRes, new(apistatus.ObjectLocked)
|
||||
return new(apistatus.ObjectLocked)
|
||||
}
|
||||
|
||||
if splitInfo != nil {
|
||||
e.deleteChildren(ctx, prm.addr, prm.forceRemoval, splitInfo.SplitID())
|
||||
}
|
||||
|
||||
return deleteRes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *StorageEngine) deleteChildren(ctx context.Context, addr oid.Address, force bool, splitID *objectSDK.SplitID) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue