mirror of https://github.com/hashicorp/consul
Use ReadTxn interface in state store helper functions
parent
69dbc926ad
commit
086a8ea8eb
|
@ -7,30 +7,30 @@ import (
|
||||||
"github.com/hashicorp/go-memdb"
|
"github.com/hashicorp/go-memdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func firstWithTxn(tx *txn,
|
func firstWithTxn(tx ReadTxn,
|
||||||
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (interface{}, error) {
|
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (interface{}, error) {
|
||||||
|
|
||||||
return tx.First(table, index, idxVal)
|
return tx.First(table, index, idxVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func firstWatchWithTxn(tx *txn,
|
func firstWatchWithTxn(tx ReadTxn,
|
||||||
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) {
|
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (<-chan struct{}, interface{}, error) {
|
||||||
|
|
||||||
return tx.FirstWatch(table, index, idxVal)
|
return tx.FirstWatch(table, index, idxVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func firstWatchCompoundWithTxn(tx *txn,
|
func firstWatchCompoundWithTxn(tx ReadTxn,
|
||||||
table, index string, _ *structs.EnterpriseMeta, idxVals ...interface{}) (<-chan struct{}, interface{}, error) {
|
table, index string, _ *structs.EnterpriseMeta, idxVals ...interface{}) (<-chan struct{}, interface{}, error) {
|
||||||
return tx.FirstWatch(table, index, idxVals...)
|
return tx.FirstWatch(table, index, idxVals...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWithTxn(tx *txn,
|
func getWithTxn(tx ReadTxn,
|
||||||
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
table, index, idxVal string, entMeta *structs.EnterpriseMeta) (memdb.ResultIterator, error) {
|
||||||
|
|
||||||
return tx.Get(table, index, idxVal)
|
return tx.Get(table, index, idxVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCompoundWithTxn(tx *txn, table, index string,
|
func getCompoundWithTxn(tx ReadTxn, table, index string,
|
||||||
_ *structs.EnterpriseMeta, idxVals ...interface{}) (memdb.ResultIterator, error) {
|
_ *structs.EnterpriseMeta, idxVals ...interface{}) (memdb.ResultIterator, error) {
|
||||||
|
|
||||||
return tx.Get(table, index, idxVals...)
|
return tx.Get(table, index, idxVals...)
|
||||||
|
|
Loading…
Reference in New Issue