Search in sources :

Example 1 with GraphDatabaseConfiguration

use of com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration in project titan by thinkaurelius.

the class ThriftGraphSpeedTest method getGraph.

@Override
protected StandardTitanGraph getGraph() throws BackendException {
    if (null == graph) {
        GraphDatabaseConfiguration graphconfig = new GraphDatabaseConfiguration(conf);
        graphconfig.getBackend().clearStorage();
        log.debug("Cleared backend storage");
        graph = (StandardTitanGraph) TitanFactory.open(conf);
        initializeGraph(graph);
    }
    return graph;
}
Also used : GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)

Example 2 with GraphDatabaseConfiguration

use of com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration in project titan by thinkaurelius.

the class TitanCleanup method clear.

/**
     * Clears out the entire graph. This will delete ALL of the data stored in this graph and the data will NOT be
     * recoverable. This method is intended only for development and testing use.
     *
     * @param graph
     * @throws IllegalArgumentException if the graph has not been shut down
     * @throws com.thinkaurelius.titan.core.TitanException if clearing the storage is unsuccessful
     */
public static final void clear(TitanGraph graph) {
    Preconditions.checkNotNull(graph);
    Preconditions.checkArgument(graph instanceof StandardTitanGraph, "Invalid graph instance detected: %s", graph.getClass());
    StandardTitanGraph g = (StandardTitanGraph) graph;
    Preconditions.checkArgument(!g.isOpen(), "Graph needs to be shut down before it can be cleared.");
    final GraphDatabaseConfiguration config = g.getConfiguration();
    BackendOperation.execute(new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            config.getBackend().clearStorage();
            return true;
        }

        @Override
        public String toString() {
            return "ClearBackend";
        }
    }, Duration.ofSeconds(20));
}
Also used : StandardTitanGraph(com.thinkaurelius.titan.graphdb.database.StandardTitanGraph) GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)

Aggregations

GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)2 StandardTitanGraph (com.thinkaurelius.titan.graphdb.database.StandardTitanGraph)1