2020-12-11 08:04:04 +00:00
|
|
|
package deletesvc
|
|
|
|
|
|
|
|
import (
|
2023-04-04 09:45:59 +00:00
|
|
|
"context"
|
2023-08-25 07:57:31 +00:00
|
|
|
"fmt"
|
2023-04-04 09:45:59 +00:00
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-07-06 12:36:41 +00:00
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2023-03-07 13:38:26 +00:00
|
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
2020-12-11 08:04:04 +00:00
|
|
|
)
|
|
|
|
|
2023-08-25 07:57:31 +00:00
|
|
|
func (exec *execCtx) executeLocal(ctx context.Context) error {
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteFormingTombstoneStructure)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2023-08-25 07:57:31 +00:00
|
|
|
if err := exec.formTombstone(ctx); err != nil {
|
|
|
|
return err
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteTombstoneStructureSuccessfullyFormedSaving)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2023-08-25 07:57:31 +00:00
|
|
|
return exec.saveTombstone(ctx)
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|
|
|
|
|
2023-08-25 07:57:31 +00:00
|
|
|
func (exec *execCtx) formTombstone(ctx context.Context) error {
|
2021-02-17 12:30:11 +00:00
|
|
|
tsLifetime, err := exec.svc.netInfo.TombstoneLifetime()
|
|
|
|
if err != nil {
|
2023-08-25 07:57:31 +00:00
|
|
|
return fmt.Errorf("fetch tombstone lifetime: %w", err)
|
2021-02-17 12:30:11 +00:00
|
|
|
}
|
|
|
|
|
2023-07-06 12:36:41 +00:00
|
|
|
exec.tombstone = objectSDK.NewTombstone()
|
2021-02-17 12:30:11 +00:00
|
|
|
exec.tombstone.SetExpirationEpoch(
|
|
|
|
exec.svc.netInfo.CurrentEpoch() + tsLifetime,
|
|
|
|
)
|
2022-05-31 17:00:41 +00:00
|
|
|
exec.addMembers([]oid.ID{exec.address().Object()})
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteFormingSplitInfo)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2024-05-27 19:07:43 +00:00
|
|
|
if err := exec.formExtendedInfo(ctx); err != nil {
|
|
|
|
return fmt.Errorf("form extended info: %w", err)
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|
|
|
|
|
2023-08-25 07:57:31 +00:00
|
|
|
return exec.initTombstoneObject()
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|