forked from TrueCloudLab/frostfs-node
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package deletesvc
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
|
)
|
|
|
|
func (exec *execCtx) executeLocal(ctx context.Context) error {
|
|
exec.log.Debug(logs.DeleteFormingTombstoneStructure)
|
|
|
|
if err := exec.formTombstone(ctx); err != nil {
|
|
return err
|
|
}
|
|
|
|
exec.log.Debug(logs.DeleteTombstoneStructureSuccessfullyFormedSaving)
|
|
|
|
return exec.saveTombstone(ctx)
|
|
}
|
|
|
|
func (exec *execCtx) formTombstone(ctx context.Context) error {
|
|
tsLifetime, err := exec.svc.netInfo.TombstoneLifetime()
|
|
if err != nil {
|
|
return fmt.Errorf("fetch tombstone lifetime: %w", err)
|
|
}
|
|
|
|
exec.tombstone = objectSDK.NewTombstone()
|
|
exec.tombstone.SetExpirationEpoch(
|
|
exec.svc.netInfo.CurrentEpoch() + tsLifetime,
|
|
)
|
|
exec.addMembers([]oid.ID{exec.address().Object()})
|
|
|
|
exec.log.Debug(logs.DeleteFormingSplitInfo)
|
|
|
|
if err := exec.formExtendedInfo(ctx); err != nil {
|
|
return fmt.Errorf("form extended info: %w", err)
|
|
}
|
|
|
|
return exec.initTombstoneObject()
|
|
}
|