2019-11-25 17:57:35 +00:00
|
|
|
// +build !consulent
|
|
|
|
|
|
|
|
package state
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2020-09-03 23:38:03 +00:00
|
|
|
func (g *Graveyard) insertTombstoneWithTxn(tx WriteTxn, _ string, stone *Tombstone, updateMax bool) error {
|
2019-11-25 17:57:35 +00:00
|
|
|
if err := tx.Insert("tombstones", stone); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if updateMax {
|
|
|
|
if err := indexUpdateMaxTxn(tx, stone.Index, "tombstones"); err != nil {
|
|
|
|
return fmt.Errorf("failed updating tombstone index: %v", err)
|
|
|
|
}
|
|
|
|
} else {
|
2021-03-08 18:02:41 +00:00
|
|
|
if err := tx.Insert(tableIndex, &IndexEntry{"tombstones", stone.Index}); err != nil {
|
2019-11-25 17:57:35 +00:00
|
|
|
return fmt.Errorf("failed updating tombstone index: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|