memdb: directly cast, avoid unsafe

This commit is contained in:
Armon Dadgar 2015-06-16 12:06:30 -07:00
parent a3d27408a2
commit dae01c9e26
1 changed files with 2 additions and 4 deletions

View File

@ -38,8 +38,7 @@ func (txn *Txn) readableIndex(table, index string) *iradix.Txn {
// Create a read transaction
path := indexPath(table, index)
raw, _ := txn.rootTxn.Get(path)
indexRoot := toTree(raw)
indexTxn := indexRoot.Txn()
indexTxn := raw.(*iradix.Tree).Txn()
return indexTxn
}
@ -60,8 +59,7 @@ func (txn *Txn) writableIndex(table, index string) *iradix.Txn {
// Start a new transaction
path := indexPath(table, index)
raw, _ := txn.rootTxn.Get(path)
indexRoot := toTree(raw)
indexTxn := indexRoot.Txn()
indexTxn := raw.(*iradix.Tree).Txn()
// Keep this open for the duration of the txn
txn.modified[key] = indexTxn