Interface GraphManager
-
- All Known Implementing Classes:
CheckedGraphManager,DefaultGraphManager
public interface GraphManagerTheGraphManagerinterface allows for reference tracking of Graph references through aMap<String, Graph>; the interface plugs into the lifeline of gremlin script executions, meaning that commit() and rollback() will be called on all graphs stored in the graph reference tracker at the end of the script executions; you may want to implement this interface if you want to define a custom graph instantiation/closing mechanism; note that the interface also defines similar features forTraversalSourceobjects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidbeforeQueryStart(RequestMessage msg)This method will be called before a script or query is processed by the gremlin-server.voidcommit(Set<String> graphSourceNamesToCloseTxOn)Selectively commit transactions on the specified graphs or the graphs of traversal sources.voidcommitAll()Commit transactions across allGraphobjects.BindingsgetAsBindings()Get theGraphandTraversalSourcelist as a set of bindings.GraphgetGraph(String graphName)GetGraphinstance whose name matchesgraphName.Set<String>getGraphNames()TraversalSourcegetTraversalSource(String traversalSourceName)GetTraversalSourceinstance whose name matchestraversalSourceNameSet<String>getTraversalSourceNames()Get aSetof the names of the the storedTraversalSourceinstances.default booleanhasAnyOpenTransactions()Determines if anyGraphinstances that support transactions have open transactions.default voidonQueryError(RequestMessage msg, Throwable error)This method will be called before a script or query is processed by the gremlin-server.default voidonQuerySuccess(RequestMessage msg)When a script or query successfully completes this method will be called.GraphopenGraph(String graphName, Function<String,Graph> supplier)Implementation that allows for custom graph-opening implementations; if theMaptracking graph references has aGraphobject corresponding to the graph name, then we return thatGraph-- otherwise, we use the customFunctionto instantiate a newGraph, add it to theMaptracking graph references, and return saidGraph.voidputGraph(String graphName, Graph g)Add or update the specifiedGraphwith the specified name toMap<String, Graph>.voidputTraversalSource(String tsName, TraversalSource ts)Add or update the specifiedTraversalSourcewith the specified name.GraphremoveGraph(String graphName)Implementation that allows for custom graph closing implementations; this method should remove theGraphfrom theGraphManager.TraversalSourceremoveTraversalSource(String tsName)RemoveTraversalSourceby name.voidrollback(Set<String> graphSourceNamesToCloseTxOn)Selectively rollback transactions on the specified graphs or the graphs of traversal sources.voidrollbackAll()Rollback transactions across allGraphobjects.
-
-
-
Method Detail
-
getGraph
Graph getGraph(String graphName)
GetGraphinstance whose name matchesgraphName.- Returns:
Graphif exists, else null
-
putGraph
void putGraph(String graphName, Graph g)
Add or update the specifiedGraphwith the specified name toMap<String, Graph>.
-
getTraversalSourceNames
Set<String> getTraversalSourceNames()
Get aSetof the names of the the storedTraversalSourceinstances.
-
getTraversalSource
TraversalSource getTraversalSource(String traversalSourceName)
GetTraversalSourceinstance whose name matchestraversalSourceName- Returns:
TraversalSourceif exists, else null
-
putTraversalSource
void putTraversalSource(String tsName, TraversalSource ts)
Add or update the specifiedTraversalSourcewith the specified name.
-
removeTraversalSource
TraversalSource removeTraversalSource(String tsName)
RemoveTraversalSourceby name.
-
getAsBindings
Bindings getAsBindings()
Get theGraphandTraversalSourcelist as a set of bindings.
-
rollbackAll
void rollbackAll()
Rollback transactions across allGraphobjects.
-
rollback
void rollback(Set<String> graphSourceNamesToCloseTxOn)
Selectively rollback transactions on the specified graphs or the graphs of traversal sources.
-
commitAll
void commitAll()
Commit transactions across allGraphobjects.
-
commit
void commit(Set<String> graphSourceNamesToCloseTxOn)
Selectively commit transactions on the specified graphs or the graphs of traversal sources.
-
openGraph
Graph openGraph(String graphName, Function<String,Graph> supplier)
Implementation that allows for custom graph-opening implementations; if theMaptracking graph references has aGraphobject corresponding to the graph name, then we return thatGraph-- otherwise, we use the customFunctionto instantiate a newGraph, add it to theMaptracking graph references, and return saidGraph.
-
removeGraph
Graph removeGraph(String graphName) throws Exception
Implementation that allows for custom graph closing implementations; this method should remove theGraphfrom theGraphManager.- Throws:
Exception
-
hasAnyOpenTransactions
default boolean hasAnyOpenTransactions()
Determines if anyGraphinstances that support transactions have open transactions.
-
beforeQueryStart
default void beforeQueryStart(RequestMessage msg)
This method will be called before a script or query is processed by the gremlin-server.- Parameters:
msg- theRequestMessagereceived by the gremlin-server.
-
onQueryError
default void onQueryError(RequestMessage msg, Throwable error)
This method will be called before a script or query is processed by the gremlin-server.- Parameters:
msg- theRequestMessagereceived by the gremlin-server.error- the exception encountered during processing from the gremlin-server.
-
onQuerySuccess
default void onQuerySuccess(RequestMessage msg)
When a script or query successfully completes this method will be called.- Parameters:
msg- theRequestMessagereceived by the gremlin-server.
-
-