f9b2834171
Required also converting some of the transaction functions to WriteTxn because TxnRO() called the same helper as TxnRW. This change allows us to return a memdb.Txn for read-only txn instead of wrapping them with state.txn.
25 lines
578 B
Go
25 lines
578 B
Go
// +build !consulent
|
|
|
|
package state
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func (g *Graveyard) insertTombstoneWithTxn(tx WriteTxn, _ 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
|
|
}
|