Search in sources :

Example 1 with LevelDbDataSourceImpl

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;
}
Also used : LevelDbDataSourceImpl(org.tron.common.storage.leveldb.LevelDbDataSourceImpl) Named(javax.inject.Named) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 2 with LevelDbDataSourceImpl

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;
}
Also used : LevelDbDataSourceImpl(org.tron.common.storage.leveldb.LevelDbDataSourceImpl) Named(javax.inject.Named) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 3 with LevelDbDataSourceImpl

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);
}
Also used : LevelDbDataSourceImpl(org.tron.common.storage.leveldb.LevelDbDataSourceImpl)

Aggregations

LevelDbDataSourceImpl (org.tron.common.storage.leveldb.LevelDbDataSourceImpl)3 Provides (com.google.inject.Provides)2 Singleton (com.google.inject.Singleton)2 Named (javax.inject.Named)2