use of tech.pegasys.teku.storage.server.VersionedDatabaseFactory in project teku by ConsenSys.
the class StorageService method doStart.
@Override
protected SafeFuture<?> doStart() {
return SafeFuture.fromRunnable(() -> {
final VersionedDatabaseFactory dbFactory = new VersionedDatabaseFactory(serviceConfig.getMetricsSystem(), serviceConfig.getDataDirLayout().getBeaconDataDirectory(), config.getDataStorageMode(), config.getDataStorageCreateDbVersion(), config.getDataStorageFrequency(), config.getEth1DepositContract(), config.isStoreNonCanonicalBlocksEnabled(), config.getMaxKnownNodeCacheSize(), config.getSpec());
database = dbFactory.createDatabase();
chainStorage = ChainStorage.create(database, config.getSpec());
final DepositStorage depositStorage = DepositStorage.create(serviceConfig.getEventChannels().getPublisher(Eth1EventsChannel.class), database);
serviceConfig.getEventChannels().subscribe(Eth1DepositStorageChannel.class, depositStorage).subscribe(Eth1EventsChannel.class, depositStorage).subscribe(StorageUpdateChannel.class, chainStorage).subscribe(VoteUpdateChannel.class, chainStorage).subscribeMultithreaded(StorageQueryChannel.class, chainStorage, STORAGE_QUERY_CHANNEL_PARALLELISM);
});
}
use of tech.pegasys.teku.storage.server.VersionedDatabaseFactory in project teku by ConsenSys.
the class WeakSubjectivityCommand method createDatabase.
private Database createDatabase(final BeaconNodeDataOptions dataOptions, final DataStorageOptions dataStorageOptions, final Eth2NetworkOptions eth2NetworkOptions) {
final Spec spec = eth2NetworkOptions.getNetworkConfiguration().getSpec();
final VersionedDatabaseFactory databaseFactory = new VersionedDatabaseFactory(new NoOpMetricsSystem(), DataDirLayout.createFrom(dataOptions.getDataConfig()).getBeaconDataDirectory(), dataStorageOptions.getDataStorageMode(), eth2NetworkOptions.getNetworkConfiguration().getEth1DepositContractAddress(), dataStorageOptions.isStoreNonCanonicalBlocks(), spec);
return databaseFactory.createDatabase();
}
use of tech.pegasys.teku.storage.server.VersionedDatabaseFactory in project teku by ConsenSys.
the class DebugDbCommand method createDatabase.
private Database createDatabase(final BeaconNodeDataOptions dataOptions, final DataStorageOptions dataStorageOptions, final Eth2NetworkOptions eth2NetworkOptions) {
final Spec spec = eth2NetworkOptions.getNetworkConfiguration().getSpec();
final VersionedDatabaseFactory databaseFactory = new VersionedDatabaseFactory(new NoOpMetricsSystem(), DataDirLayout.createFrom(dataOptions.getDataConfig()).getBeaconDataDirectory(), dataStorageOptions.getDataStorageMode(), eth2NetworkOptions.getNetworkConfiguration().getEth1DepositContractAddress(), dataStorageOptions.isStoreNonCanonicalBlocks(), spec);
return databaseFactory.createDatabase();
}
use of tech.pegasys.teku.storage.server.VersionedDatabaseFactory in project teku by ConsenSys.
the class DatabaseMigrater method createDatabase.
@VisibleForTesting
KvStoreDatabase createDatabase(final Path databasePath, DatabaseVersion databaseVersion) throws DatabaseMigraterError {
final Eth2NetworkConfiguration config = Eth2NetworkConfiguration.builder(network).build();
final VersionedDatabaseFactory databaseFactory = new VersionedDatabaseFactory(new NoOpMetricsSystem(), databasePath, storageMode, databaseVersion, DEFAULT_STORAGE_FREQUENCY, config.getEth1DepositContractAddress(), true, 0, spec);
final Database database = databaseFactory.createDatabase();
if (!(database instanceof KvStoreDatabase)) {
throw new DatabaseMigraterError("Expected the database at " + databasePath.toFile() + " to be a KV store, but it was not, not able to migrate data.");
}
return (KvStoreDatabase) database;
}
Aggregations