2020-12-11 08:04:04 +00:00
|
|
|
package deletesvc
|
|
|
|
|
|
|
|
import (
|
2022-12-23 17:35:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/object"
|
|
|
|
oid "github.com/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
|
|
|
)
|
|
|
|
|
|
|
|
func (exec *execCtx) executeLocal() {
|
|
|
|
exec.log.Debug("forming tombstone structure...")
|
|
|
|
|
|
|
|
ok := exec.formTombstone()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
exec.log.Debug("tombstone structure successfully formed, saving...")
|
|
|
|
|
2022-03-05 10:43:13 +00:00
|
|
|
exec.saveTombstone()
|
2020-12-11 08:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (exec *execCtx) formTombstone() (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
|
|
|
|
|
|
|
|
exec.log.Debug("could not read tombstone lifetime config",
|
|
|
|
zap.String("error", err.Error()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-03-03 14:19:05 +00:00
|
|
|
exec.tombstone = object.NewTombstone()
|
2021-02-17 12:30:11 +00:00
|
|
|
exec.tombstone.SetExpirationEpoch(
|
|
|
|
exec.svc.netInfo.CurrentEpoch() + tsLifetime,
|
|
|
|
)
|
2022-12-30 11:00:01 +00:00
|
|
|
exec.addMembers([]oid.ID{exec.prm.addr.Object()})
|
2020-12-11 08:04:04 +00:00
|
|
|
|
|
|
|
exec.log.Debug("forming split info...")
|
|
|
|
|
|
|
|
ok = exec.formSplitInfo()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
exec.log.Debug("split info successfully formed, collecting members...")
|
|
|
|
|
2020-12-11 11:29:31 +00:00
|
|
|
exec.tombstone.SetSplitID(exec.splitInfo.SplitID())
|
|
|
|
|
2020-12-11 08:04:04 +00:00
|
|
|
ok = exec.collectMembers()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
exec.log.Debug("members successfully collected")
|
|
|
|
|
|
|
|
ok = exec.initTombstoneObject()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|