frostfs-node/pkg/services/object/delete/delete.go
Evgenii Stratonikov d2084ece41 [#648] objsvc/delete: Remove redundant logs
We never propagate delete requests to the container node, because
tombstone broadcast is done via PUT. No need to pollute logs.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-08-25 09:45:35 +00:00

55 lines
1.2 KiB
Go

package deletesvc
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"go.uber.org/zap"
)
// Delete serves requests to remote the objects.
func (s *Service) Delete(ctx context.Context, prm Prm) error {
// If session token is not found we will fail during tombstone PUT.
// Here we fail immediately to ensure no unnecessary network communication is done.
if tok := prm.common.SessionToken(); tok != nil {
_, err := s.keyStorage.GetKey(&util.SessionInfo{
ID: tok.ID(),
Owner: tok.Issuer(),
})
if err != nil {
return err
}
}
exec := &execCtx{
svc: s,
prm: prm,
}
exec.setLogger(s.log)
exec.execute(ctx)
return exec.statusError.err
}
func (exec *execCtx) execute(ctx context.Context) {
exec.log.Debug(logs.ServingRequest)
// perform local operation
exec.executeLocal(ctx)
exec.analyzeStatus()
}
func (exec *execCtx) analyzeStatus() {
// analyze local result
switch exec.status {
case statusOK:
exec.log.Debug(logs.OperationFinishedSuccessfully)
default:
exec.log.Debug(logs.OperationFinishedWithError,
zap.String("error", exec.err.Error()),
)
}
}