Interface GraphManager

  • All Known Implementing Classes:
    CheckedGraphManager, DefaultGraphManager

    public interface GraphManager
    The GraphManager interface allows for reference tracking of Graph references through a Map<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 for TraversalSource objects.
    • Method Detail

      • getGraphNames

        Set<String> getGraphNames()
        Get a Set of String graphNames corresponding to names stored in the graph's reference tracker.
      • getGraph

        Graph getGraph​(String graphName)
        Get Graph instance whose name matches graphName.
        Graph if exists, else null
      • putGraph

        void putGraph​(String graphName,
                      Graph g)
        Add or update the specified Graph with the specified name to Map<String, Graph> .
      • getTraversalSourceNames

        Set<String> getTraversalSourceNames()
        Get a Set of the names of the the stored TraversalSource instances.
      • rollbackAll

        void rollbackAll()
        Rollback transactions across all Graph objects.
      • 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 all Graph objects.
      • 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 the Map tracking graph references has a Graph object corresponding to the graph name, then we return that Graph-- otherwise, we use the custom Function to instantiate a new Graph, add it to the Map tracking graph references, and return said Graph.
      • removeGraph

        Graph removeGraph​(String graphName)
                   throws Exception
        Implementation that allows for custom graph closing implementations; this method should remove the Graph from the GraphManager.
      • hasAnyOpenTransactions

        default boolean hasAnyOpenTransactions()
        Determines if any Graph instances that support transactions have open transactions.