@Override public String prettyPrint(int depth, int indent) { String spaces = OExecutionStepInternal.getIndent(depth, indent); String result = spaces + "+ FETCH STORAGE METADATA"; if (profilingEnabled) { result += " (" + getCostFormatted() + ")"; } return result; }
@Override public OResultSet syncPull(OCommandContext ctx, int nRecords) throws OTimeoutException { getPrev().ifPresent(x -> x.syncPull(ctx, nRecords)); return new OResultSet() { @Override
private void handleMetadataAsTarget(OSelectExecutionPlan plan, OMetadataIdentifier metadata, OCommandContext ctx, boolean profilingEnabled) { ODatabaseInternal db = (ODatabaseInternal) ctx.getDatabase(); String schemaRecordIdAsString = null; if (metadata.getName().equalsIgnoreCase(OCommandExecutorSQLAbstract.METADATA_SCHEMA)) { schemaRecordIdAsString = db.getStorage().getConfiguration().getSchemaRecordId(); ORecordId schemaRid = new ORecordId(schemaRecordIdAsString); plan.chain(new FetchFromRidsStep(Collections.singleton(schemaRid), ctx, profilingEnabled)); } else if (metadata.getName().equalsIgnoreCase(OCommandExecutorSQLAbstract.METADATA_INDEXMGR)) { schemaRecordIdAsString = db.getStorage().getConfiguration().getIndexMgrRecordId(); ORecordId schemaRid = new ORecordId(schemaRecordIdAsString); plan.chain(new FetchFromRidsStep(Collections.singleton(schemaRid), ctx, profilingEnabled)); } else if (metadata.getName().equalsIgnoreCase(OCommandExecutorSQLAbstract.METADATA_STORAGE)) { plan.chain(new FetchFromStorageMetadataStep(ctx, profilingEnabled)); } else if (metadata.getName().equalsIgnoreCase(OCommandExecutorSQLAbstract.METADATA_DATABASE)) { plan.chain(new FetchFromDatabaseMetadataStep(ctx, profilingEnabled)); } else { throw new UnsupportedOperationException("Invalid metadata: " + metadata.getName()); } }
private Object toResult(OStorageConfiguration configuration) { OResultInternal result = new OResultInternal(); result.setProperty("charset", configuration.getCharset()); result.setProperty("clusterSelection", configuration.getClusterSelection()); result.setProperty("conflictStrategy", configuration.getConflictStrategy()); result.setProperty("dateFormat", configuration.getDateFormat()); result.setProperty("dateTimeFormat", configuration.getDateTimeFormat()); result.setProperty("localeCountry", configuration.getLocaleCountry()); result.setProperty("localeLanguage", configuration.getLocaleLanguage()); result.setProperty("recordSerializer", configuration.getRecordSerializer()); result.setProperty("timezone", String.valueOf(configuration.getTimeZone())); result.setProperty("properties", toResult(configuration.getProperties())); return result; }