open-consul/agent/consul/state/graveyard_oss.go

27 lines
580 B
Go
Raw Normal View History

// +build !consulent
package state
import (
"fmt"
)
2020-06-03 17:21:00 +00:00
func (g *Graveyard) insertTombstoneWithTxn(tx *txn,
table string, stone *Tombstone, updateMax bool) error {
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 {
if err := tx.Insert("index", &IndexEntry{"tombstones", stone.Index}); err != nil {
return fmt.Errorf("failed updating tombstone index: %s", err)
}
}
return nil
}