use of org.tron.common.storage.leveldb.LevelDbDataSourceImpl in project java-tron by tronprotocol.
the class Module method buildTransactionDb.
/**
* build transaction database.
*/
@Provides
@Singleton
@Named("transaction")
public LevelDbDataSourceImpl buildTransactionDb() {
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(), TRANSACTION_DB_NAME);
db.initDB();
return db;
}
use of org.tron.common.storage.leveldb.LevelDbDataSourceImpl in project java-tron by tronprotocol.
the class Module method buildBlockDb.
/**
* build block database.
*/
@Provides
@Singleton
@Named("block")
public LevelDbDataSourceImpl buildBlockDb() {
LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(), BLOCK_DB_NAME);
db.initDB();
return db;
}
use of org.tron.common.storage.leveldb.LevelDbDataSourceImpl in project java-tron by tronprotocol.
the class Manager method init.
/**
* all db should be init here.
*/
public void init() {
this.setAccountStore(AccountStore.create("account"));
this.setTransactionStore(TransactionStore.create("trans"));
this.setBlockStore(BlockStore.create("block"));
this.setUtxoStore(UtxoStore.create("utxo"));
this.setWitnessStore(WitnessStore.create("witness"));
this.setAssetIssueStore(AssetIssueStore.create("asset-issue"));
this.setDynamicPropertiesStore(DynamicPropertiesStore.create("properties"));
revokingStore = RevokingStore.getInstance();
revokingStore.enable();
this.numHashCache = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(), "block" + "_NUM_HASH");
this.numHashCache.initDB();
this.khaosDb = new KhaosDatabase("block" + "_KDB");
this.pendingTransactions = new ArrayList<>();
this.initGenesis();
this.updateWits();
this.setShuffledWitnessStates(getWitnesses());
this.initHeadBlock(Sha256Hash.wrap(this.dynamicPropertiesStore.getLatestBlockHeaderHash()));
this.khaosDb.start(head);
}
Aggregations