if (db.getStorage().isRemote()) { isRemote = true;
@Override public void register(final ODatabaseDocumentTx db, final Runnable initializer) { // force single cluster to benefit from implicit event ordering if (db.getStorage().getConfiguration().getMinimumClusters() != 1) { db.getStorage().setMinimumClusters(1); } super.register(db, initializer); }
@Override public void restore(final InputStream input, final boolean overwrite) throws IOException { checkNotNull(input); log.debug("Restoring database: {}", name); try (ODatabaseDocumentTx db = openDb()) { if (db.exists()) { checkState(overwrite, "Database already exists: %s", name); } else { db.create(); } log.debug("Starting restore"); db.restore(input, null, null, new LoggingCommandOutputListener("RESTORE")); log.debug("Completed restore"); if (db.getStorage().isClosed()) { // restore can leave storage layer closed, so re-open it db.getStorage().open(SYSTEM_USER, SYSTEM_PASSWORD, null); } } }
public static GRAPH_CONSISTENCY_MODE getConsistencyMode(final OrientBaseGraph graph) { final String consistencyMode = graph.getRawGraph().getStorage().getConfiguration().getProperty("graphConsistencyMode"); if (consistencyMode == null) return GRAPH_CONSISTENCY_MODE.TX; return GRAPH_CONSISTENCY_MODE.valueOf(consistencyMode); }
/** * Enables password-based-encryption for records of the given type. * * Can only be called when creating the schema. * * @since 3.1 */ protected void enableRecordEncryption(final ODatabaseDocumentTx db, final OClass type) { OStorage storage = db.getStorage(); for (int clusterId : type.getClusterIds()) { OCluster cluster = storage.getClusterById(clusterId); try { log.debug("Enabling PBE compression for cluster: {}", cluster.getName()); cluster.set(OCluster.ATTRIBUTES.COMPRESSION, PbeCompression.NAME); } catch (IOException e) { throw new RuntimeException(e); } catch (IllegalArgumentException | OStorageException | OSecurityException e) { log.warn("Cannot enable PBE compression for cluster: {}", cluster.getName(), e); } } }