Search in sources :

Example 1 with MerkleDataInputStream

use of com.swirlds.common.merkle.io.MerkleDataInputStream in project hedera-services by hashgraph.

the class AccountsReader method from.

public static MerkleMap<EntityNum, MerkleAccount> from(String loc) throws Exception {
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(MerkleLong.class, MerkleLong::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(FCQueue.class, FCQueue::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(MerkleMap.class, MerkleMap::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(MerkleEntityId.class, MerkleEntityId::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(EntityId.class, EntityId::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(MerkleAccount.class, MerkleAccount::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(MerkleAccountState.class, MerkleAccountState::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(ExpirableTxnRecord.class, ExpirableTxnRecord::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(TxnReceipt.class, TxnReceipt::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(TxnId.class, TxnId::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(CurrencyAdjustments.class, CurrencyAdjustments::new));
    ConstructableRegistry.registerConstructable(new ClassConstructorPair(EvmFnResult.class, EvmFnResult::new));
    try (MerkleDataInputStream in = new MerkleDataInputStream(Files.newInputStream(Path.of(loc)))) {
        MerkleMap<EntityNum, MerkleAccount> fcm = in.readMerkleTree(Integer.MAX_VALUE);
        return fcm;
    }
}
Also used : ExpirableTxnRecord(com.hedera.services.state.submerkle.ExpirableTxnRecord) FCQueue(com.swirlds.fcqueue.FCQueue) MerkleDataInputStream(com.swirlds.common.merkle.io.MerkleDataInputStream) TxnReceipt(com.hedera.services.legacy.core.jproto.TxnReceipt) MerkleAccount(com.hedera.services.state.merkle.MerkleAccount) MerkleEntityId(com.hedera.services.state.merkle.MerkleEntityId) MerkleAccountState(com.hedera.services.state.merkle.MerkleAccountState) EntityNum(com.hedera.services.utils.EntityNum) MerkleLong(com.swirlds.common.merkle.utility.MerkleLong) EntityId(com.hedera.services.state.submerkle.EntityId) MerkleEntityId(com.hedera.services.state.merkle.MerkleEntityId) TxnId(com.hedera.services.state.submerkle.TxnId) EvmFnResult(com.hedera.services.state.submerkle.EvmFnResult) MerkleMap(com.swirlds.merkle.map.MerkleMap) CurrencyAdjustments(com.hedera.services.state.submerkle.CurrencyAdjustments) ClassConstructorPair(com.swirlds.common.constructable.ClassConstructorPair)

Example 2 with MerkleDataInputStream

use of com.swirlds.common.merkle.io.MerkleDataInputStream in project hedera-services by hashgraph.

the class PojoFs method fromDisk.

public static PojoFs fromDisk(String dumpLoc) throws Exception {
    try (MerkleDataInputStream in = new MerkleDataInputStream(Files.newInputStream(Path.of(dumpLoc)))) {
        MerkleMap<String, MerkleOptionalBlob> fcm = in.readMerkleTree(Integer.MAX_VALUE);
        var pojo = from(fcm);
        return pojo;
    }
}
Also used : MerkleDataInputStream(com.swirlds.common.merkle.io.MerkleDataInputStream) MerkleOptionalBlob(com.hedera.services.state.merkle.MerkleOptionalBlob)

Example 3 with MerkleDataInputStream

use of com.swirlds.common.merkle.io.MerkleDataInputStream in project hedera-services by hashgraph.

the class PojoLedger method fromDisk.

public static PojoLedger fromDisk(String dumpLoc) throws Exception {
    try (MerkleDataInputStream in = new MerkleDataInputStream(Files.newInputStream(Path.of(dumpLoc)))) {
        MerkleMap<EntityNum, MerkleAccount> fcm = in.readMerkleTree(Integer.MAX_VALUE);
        var pojo = from(fcm);
        return pojo;
    }
}
Also used : MerkleDataInputStream(com.swirlds.common.merkle.io.MerkleDataInputStream) MerkleAccount(com.hedera.services.state.merkle.MerkleAccount) EntityNum(com.hedera.services.utils.EntityNum)

Aggregations

MerkleDataInputStream (com.swirlds.common.merkle.io.MerkleDataInputStream)3 MerkleAccount (com.hedera.services.state.merkle.MerkleAccount)2 EntityNum (com.hedera.services.utils.EntityNum)2 TxnReceipt (com.hedera.services.legacy.core.jproto.TxnReceipt)1 MerkleAccountState (com.hedera.services.state.merkle.MerkleAccountState)1 MerkleEntityId (com.hedera.services.state.merkle.MerkleEntityId)1 MerkleOptionalBlob (com.hedera.services.state.merkle.MerkleOptionalBlob)1 CurrencyAdjustments (com.hedera.services.state.submerkle.CurrencyAdjustments)1 EntityId (com.hedera.services.state.submerkle.EntityId)1 EvmFnResult (com.hedera.services.state.submerkle.EvmFnResult)1 ExpirableTxnRecord (com.hedera.services.state.submerkle.ExpirableTxnRecord)1 TxnId (com.hedera.services.state.submerkle.TxnId)1 ClassConstructorPair (com.swirlds.common.constructable.ClassConstructorPair)1 MerkleLong (com.swirlds.common.merkle.utility.MerkleLong)1 FCQueue (com.swirlds.fcqueue.FCQueue)1 MerkleMap (com.swirlds.merkle.map.MerkleMap)1