Search in sources :

Example 1 with GraphDatabaseConfiguration

use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.

the class ThriftGraphSpeedTest method getGraph.

@Override
protected StandardJanusGraph getGraph() throws BackendException {
    if (null == graph) {
        GraphDatabaseConfiguration graphDatabaseConfiguration = new GraphDatabaseConfiguration(conf);
        graphDatabaseConfiguration.getBackend().clearStorage();
        log.debug("Cleared backend storage");
        graph = (StandardJanusGraph) JanusGraphFactory.open(conf);
        initializeGraph(graph);
    }
    return graph;
}
Also used : GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)

Example 2 with GraphDatabaseConfiguration

use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.

the class CQLGraphSpeedTest method getGraph.

@Override
protected StandardJanusGraph getGraph() throws BackendException {
    if (null == graph) {
        GraphDatabaseConfiguration graphDatabaseConfiguration = new GraphDatabaseConfiguration(conf);
        graphDatabaseConfiguration.getBackend().clearStorage();
        log.debug("Cleared backend storage");
        graph = (StandardJanusGraph) JanusGraphFactory.open(conf);
        initializeGraph(graph);
    }
    return graph;
}
Also used : GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)

Example 3 with GraphDatabaseConfiguration

use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.

the class HBaseStoreManagerConfigTest method testHBaseTimestampProvider.

@Test
public // Test HBase preferred timestamp provider MILLI is set by default
void testHBaseTimestampProvider() {
    // Get an empty configuration
    // GraphDatabaseConfiguration.buildGraphConfiguration() only build an empty one.
    ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
    // Set backend to hbase
    config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "hbase");
    // Instantiate a GraphDatabaseConfiguration based on the above
    GraphDatabaseConfiguration graphConfig = new GraphDatabaseConfigurationBuilder().build(config.getConfiguration());
    // Check the TIMESTAMP_PROVIDER has been set to the hbase preferred MILLI
    TimestampProviders provider = graphConfig.getConfiguration().get(GraphDatabaseConfiguration.TIMESTAMP_PROVIDER);
    assertEquals(HBaseStoreManager.PREFERRED_TIMESTAMPS, provider);
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) TimestampProviders(org.janusgraph.diskstorage.util.time.TimestampProviders) Test(org.junit.jupiter.api.Test)

Example 4 with GraphDatabaseConfiguration

use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.

the class StandardLogProcessorFrameworkTest method createGraphWithMockedInternals.

private StandardJanusGraph createGraphWithMockedInternals() throws BackendException {
    StandardJanusGraph mockGraph = mock(StandardJanusGraph.class);
    Backend mockBackend = mock(Backend.class);
    KCVSLog mockKCVSLog = mock(KCVSLog.class);
    GraphDatabaseConfiguration gdbConfig = mock(GraphDatabaseConfiguration.class);
    TimestampProvider tsProvider = mock(TimestampProvider.class);
    Serializer mockSerializer = mock(Serializer.class);
    when(mockGraph.getConfiguration()).thenReturn(gdbConfig);
    when(mockGraph.isOpen()).thenReturn(true);
    when(mockGraph.getDataSerializer()).thenReturn(mockSerializer);
    when(mockGraph.getBackend()).thenReturn(mockBackend);
    when(mockBackend.getUserLog(anyString())).thenReturn(mockKCVSLog);
    when(gdbConfig.getTimestampProvider()).thenReturn(tsProvider);
    mockKCVSLog.registerReaders(mock(ReadMarker.class), new LinkedList<>());
    return mockGraph;
}
Also used : Backend(org.janusgraph.diskstorage.Backend) TimestampProvider(org.janusgraph.diskstorage.util.time.TimestampProvider) KCVSLog(org.janusgraph.diskstorage.log.kcvs.KCVSLog) ReadMarker(org.janusgraph.diskstorage.log.ReadMarker) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) Serializer(org.janusgraph.graphdb.database.serialize.Serializer)

Example 5 with GraphDatabaseConfiguration

use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.

the class GraphDatabaseConfigurationBuilder method build.

public GraphDatabaseConfiguration build(ReadConfiguration localConfig) {
    Preconditions.checkNotNull(localConfig);
    BasicConfiguration localBasicConfiguration = new BasicConfiguration(ROOT_NS, localConfig, BasicConfiguration.Restriction.NONE);
    ModifiableConfiguration overwrite = new ModifiableConfiguration(ROOT_NS, new CommonsConfiguration(), BasicConfiguration.Restriction.NONE);
    final KeyColumnValueStoreManager storeManager = Backend.getStorageManager(localBasicConfiguration);
    final StoreFeatures storeFeatures = storeManager.getFeatures();
    final ReadConfiguration globalConfig = new ReadConfigurationBuilder().buildGlobalConfiguration(localConfig, localBasicConfiguration, overwrite, storeManager, new ModifiableConfigurationBuilder(), new KCVSConfigurationBuilder());
    // Copy over local config options
    ModifiableConfiguration localConfiguration = new ModifiableConfiguration(ROOT_NS, new CommonsConfiguration(), BasicConfiguration.Restriction.LOCAL);
    localConfiguration.setAll(getLocalSubset(localBasicConfiguration.getAll()));
    Configuration combinedConfig = new MixedConfiguration(ROOT_NS, globalConfig, localConfig);
    // Compute unique instance id
    String uniqueGraphId = UniqueInstanceIdRetriever.getInstance().getOrGenerateUniqueInstanceId(combinedConfig);
    overwrite.set(UNIQUE_INSTANCE_ID, uniqueGraphId);
    checkAndOverwriteTransactionLogConfiguration(combinedConfig, overwrite, storeFeatures);
    checkAndOverwriteSystemManagementLogConfiguration(combinedConfig, overwrite);
    MergedConfiguration configuration = new MergedConfiguration(overwrite, combinedConfig);
    return new GraphDatabaseConfiguration(localConfig, localConfiguration, uniqueGraphId, configuration);
}
Also used : StoreFeatures(org.janusgraph.diskstorage.keycolumnvalue.StoreFeatures) KCVSConfigurationBuilder(org.janusgraph.diskstorage.configuration.backend.builder.KCVSConfigurationBuilder) MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) MergedConfiguration(org.janusgraph.diskstorage.configuration.MergedConfiguration) MixedConfiguration(org.janusgraph.diskstorage.configuration.MixedConfiguration) Configuration(org.janusgraph.diskstorage.configuration.Configuration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) BasicConfiguration(org.janusgraph.diskstorage.configuration.BasicConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) ReadConfiguration(org.janusgraph.diskstorage.configuration.ReadConfiguration) MixedConfiguration(org.janusgraph.diskstorage.configuration.MixedConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) ReadConfiguration(org.janusgraph.diskstorage.configuration.ReadConfiguration) ModifiableConfigurationBuilder(org.janusgraph.diskstorage.configuration.builder.ModifiableConfigurationBuilder) KeyColumnValueStoreManager(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager) ReadConfigurationBuilder(org.janusgraph.diskstorage.configuration.builder.ReadConfigurationBuilder) BasicConfiguration(org.janusgraph.diskstorage.configuration.BasicConfiguration)

Aggregations

GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)7 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)3 Backend (org.janusgraph.diskstorage.Backend)2 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)2 TimestampProvider (org.janusgraph.diskstorage.util.time.TimestampProvider)2 Serializer (org.janusgraph.graphdb.database.serialize.Serializer)2 PropertyKey (org.janusgraph.core.PropertyKey)1 RelationType (org.janusgraph.core.RelationType)1 DefaultSchemaMaker (org.janusgraph.core.schema.DefaultSchemaMaker)1 PropertyKeyMaker (org.janusgraph.core.schema.PropertyKeyMaker)1 BackendTransaction (org.janusgraph.diskstorage.BackendTransaction)1 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)1 Configuration (org.janusgraph.diskstorage.configuration.Configuration)1 MergedConfiguration (org.janusgraph.diskstorage.configuration.MergedConfiguration)1 MixedConfiguration (org.janusgraph.diskstorage.configuration.MixedConfiguration)1 ReadConfiguration (org.janusgraph.diskstorage.configuration.ReadConfiguration)1 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)1 KCVSConfigurationBuilder (org.janusgraph.diskstorage.configuration.backend.builder.KCVSConfigurationBuilder)1 ModifiableConfigurationBuilder (org.janusgraph.diskstorage.configuration.builder.ModifiableConfigurationBuilder)1 ReadConfigurationBuilder (org.janusgraph.diskstorage.configuration.builder.ReadConfigurationBuilder)1