Search in sources :

Example 1 with RocksDBPlugin

use of org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin in project besu by hyperledger.

the class ThreadBesuNodeRunner method buildPluginContext.

private BesuPluginContextImpl buildPluginContext(final BesuNode node, final StorageServiceImpl storageService, final SecurityModuleServiceImpl securityModuleService, final BesuConfiguration commonPluginConfiguration) {
    final CommandLine commandLine = new CommandLine(CommandSpec.create());
    final BesuPluginContextImpl besuPluginContext = new BesuPluginContextImpl();
    besuPluginContext.addService(StorageService.class, storageService);
    besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
    besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
    final Path pluginsPath = node.homeDirectory().resolve("plugins");
    final File pluginsDirFile = pluginsPath.toFile();
    if (!pluginsDirFile.isDirectory()) {
        pluginsDirFile.mkdirs();
        pluginsDirFile.deleteOnExit();
    }
    System.setProperty("besu.plugins.dir", pluginsPath.toString());
    besuPluginContext.registerPlugins(pluginsPath);
    commandLine.parseArgs(node.getConfiguration().getExtraCLIOptions().toArray(new String[0]));
    besuPluginContext.addService(BesuConfiguration.class, commonPluginConfiguration);
    // register built-in plugins
    new RocksDBPlugin().register(besuPluginContext);
    return besuPluginContext;
}
Also used : BesuPluginContextImpl(org.hyperledger.besu.services.BesuPluginContextImpl) Path(java.nio.file.Path) CommandLine(picocli.CommandLine) RocksDBPlugin(org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin) PicoCLIOptionsImpl(org.hyperledger.besu.services.PicoCLIOptionsImpl) GenesisConfigFile(org.hyperledger.besu.config.GenesisConfigFile) File(java.io.File)

Example 2 with RocksDBPlugin

use of org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin in project besu by hyperledger.

the class BesuCommand method preparePlugins.

private void preparePlugins() {
    besuPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
    besuPluginContext.addService(SecurityModuleService.class, securityModuleService);
    besuPluginContext.addService(StorageService.class, storageService);
    besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry);
    besuPluginContext.addService(PermissioningService.class, permissioningService);
    besuPluginContext.addService(PrivacyPluginService.class, privacyPluginService);
    besuPluginContext.addService(RpcEndpointService.class, rpcEndpointServiceImpl);
    // register built-in plugins
    new RocksDBPlugin().register(besuPluginContext);
    new InMemoryStoragePlugin().register(besuPluginContext);
    besuPluginContext.registerPlugins(pluginsDir());
    metricCategoryRegistry.getMetricCategories().forEach(metricCategoryConverter::addRegistryCategory);
    // register default security module
    securityModuleService.register(DEFAULT_SECURITY_MODULE, Suppliers.memoize(this::defaultSecurityModule));
}
Also used : RocksDBPlugin(org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin) PicoCLIOptionsImpl(org.hyperledger.besu.services.PicoCLIOptionsImpl) InMemoryStoragePlugin(org.hyperledger.besu.services.kvstore.InMemoryStoragePlugin)

Aggregations

RocksDBPlugin (org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin)2 PicoCLIOptionsImpl (org.hyperledger.besu.services.PicoCLIOptionsImpl)2 File (java.io.File)1 Path (java.nio.file.Path)1 GenesisConfigFile (org.hyperledger.besu.config.GenesisConfigFile)1 BesuPluginContextImpl (org.hyperledger.besu.services.BesuPluginContextImpl)1 InMemoryStoragePlugin (org.hyperledger.besu.services.kvstore.InMemoryStoragePlugin)1 CommandLine (picocli.CommandLine)1