2020-12-11 08:04:04 +00:00
|
|
|
package deletesvc
|
|
|
|
|
|
|
|
import (
|
2023-04-04 09:45:59 +00:00
|
|
|
"context"
|
|
|
|
|
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"
|
2021-02-17 12:30:11 +00:00
|
|
|
"go.uber.org/zap"
|
2020-12-11 08:04:04 +00:00
|
|
|
)
|
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
func (exec *execCtx) executeLocal(ctx context.Context) {
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteFormingTombstoneStructure)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
ok := exec.formTombstone(ctx)
|
2020-12-11 08:04:04 +00:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteTombstoneStructureSuccessfullyFormedSaving)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
exec.saveTombstone(ctx)
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
func (exec *execCtx) formTombstone(ctx context.Context) (ok bool) {
|
2021-02-17 12:30:11 +00:00
|
|
|
tsLifetime, err := exec.svc.netInfo.TombstoneLifetime()
|
|
|
|
if err != nil {
|
|
|
|
exec.status = statusUndefined
|
|
|
|
exec.err = err
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteCouldNotReadTombstoneLifetimeConfig,
|
2021-02-17 12:30:11 +00:00
|
|
|
zap.String("error", err.Error()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
ok = exec.formSplitInfo(ctx)
|
2020-12-11 08:04:04 +00:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteSplitInfoSuccessfullyFormedCollectingMembers)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
2020-12-11 11:29:31 +00:00
|
|
|
exec.tombstone.SetSplitID(exec.splitInfo.SplitID())
|
|
|
|
|
2023-04-04 09:45:59 +00:00
|
|
|
ok = exec.collectMembers(ctx)
|
2020-12-11 08:04:04 +00:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
exec.log.Debug(logs.DeleteMembersSuccessfullyCollected)
|
2020-12-11 08:04:04 +00:00
|
|
|
|
|
|
|
ok = exec.initTombstoneObject()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|