Search in sources :

Example 1 with OBonsaiTreeRepair

use of com.tinkerpop.blueprints.impls.orient.OBonsaiTreeRepair in project orientdb by orientechnologies.

the class OGremlinConsole method repairDatabase.

@Override
@ConsoleCommand(description = "Repair database structure", splitInWords = false)
public void repairDatabase(@ConsoleParameter(name = "options", description = "Options: [--fix-graph] [--fix-links] [-v]] [--fix-ridbags] [--fix-bonsai]", optional = true) String iOptions) throws IOException {
    checkForDatabase();
    final boolean fix_graph = iOptions == null || iOptions.contains("--fix-graph");
    if (fix_graph) {
        // REPAIR GRAPH
        final Map<String, List<String>> options = parseOptions(iOptions);
        new OGraphRepair().repair(OrientGraphFactory.getNoTxGraphImplFactory().getGraph(currentDatabase), this, options);
    }
    final boolean fix_links = iOptions == null || iOptions.contains("--fix-links");
    if (fix_links) {
        // REPAIR DATABASE AT LOW LEVEL
        super.repairDatabase(iOptions);
    }
    if (!currentDatabase.getURL().startsWith("plocal")) {
        message("\n fix-bonsai can be run only on plocal connection \n");
        return;
    }
    final boolean fix_ridbags = iOptions == null || iOptions.contains("--fix-ridbags");
    if (fix_ridbags) {
        OBonsaiTreeRepair repairer = new OBonsaiTreeRepair();
        repairer.repairDatabaseRidbags(currentDatabase, this);
    }
    final boolean fix_bonsai = iOptions == null || iOptions.contains("--fix-bonsai");
    if (fix_bonsai) {
        OBonsaiTreeRepair repairer = new OBonsaiTreeRepair();
        repairer.repairDatabaseRidbags(currentDatabase, this);
    }
}
Also used : OGraphRepair(com.tinkerpop.blueprints.impls.orient.OGraphRepair) List(java.util.List) OBonsaiTreeRepair(com.tinkerpop.blueprints.impls.orient.OBonsaiTreeRepair) ConsoleCommand(com.orientechnologies.common.console.annotation.ConsoleCommand)

Aggregations

ConsoleCommand (com.orientechnologies.common.console.annotation.ConsoleCommand)1 OBonsaiTreeRepair (com.tinkerpop.blueprints.impls.orient.OBonsaiTreeRepair)1 OGraphRepair (com.tinkerpop.blueprints.impls.orient.OGraphRepair)1 List (java.util.List)1