lang: funcs, interfaces: Add the Graph method
The Txn wants to be able to call graph directly.
This commit is contained in:
@@ -624,3 +624,12 @@ func (obj *GraphTxn) Free() {
|
||||
obj.FreeFunc()
|
||||
}
|
||||
}
|
||||
|
||||
// Graph returns a copy of the contained graph. It returns what has been already
|
||||
// committed.
|
||||
func (obj *GraphTxn) Graph() *pgraph.Graph {
|
||||
obj.mutex.Lock()
|
||||
defer obj.mutex.Unlock()
|
||||
|
||||
return obj.GraphAPI.Graph() // returns a copy
|
||||
}
|
||||
|
||||
@@ -339,4 +339,8 @@ type Txn interface {
|
||||
// separate state. This allows you to do an Add*/Commit/Reverse that
|
||||
// isn't affected by a different user of this transaction.
|
||||
Copy() Txn
|
||||
|
||||
// Graph returns a copy of the graph. It returns what has been already
|
||||
// committed.
|
||||
Graph() *pgraph.Graph
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user