Search in sources :

Example 1 with ChangeSummaryManager

use of com.hedera.services.ledger.properties.ChangeSummaryManager in project hedera-services by hashgraph.

the class TransactionalLedgerTest method setup.

@BeforeEach
private void setup() {
    scopedCheck = new TestAccountScopedCheck();
    accountsLedger = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, backingAccounts, new ChangeSummaryManager<>());
    final var accountsCommitInterceptor = new AccountsCommitInterceptor(new SideEffectsTracker());
    accountsLedger.setCommitInterceptor(accountsCommitInterceptor);
    subject = new TransactionalLedger<>(TestAccountProperty.class, TestAccount::new, backingTestAccounts, changeManager);
    final var testAccountCommitInterceptor = new TestAccountCommitInterceptor(new SideEffectsTracker());
    subject.setCommitInterceptor(testAccountCommitInterceptor);
}
Also used : ChangeSummaryManager(com.hedera.services.ledger.properties.ChangeSummaryManager) SideEffectsTracker(com.hedera.services.context.SideEffectsTracker) TestAccountProperty(com.hedera.services.ledger.properties.TestAccountProperty) TestAccountCommitInterceptor(com.hedera.services.ledger.properties.TestAccountCommitInterceptor) TestAccountProperty(com.hedera.services.ledger.properties.TestAccountProperty) AccountProperty(com.hedera.services.ledger.properties.AccountProperty) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ChangeSummaryManager

use of com.hedera.services.ledger.properties.ChangeSummaryManager in project hedera-services by hashgraph.

the class LedgerBalanceChangesTest method setUp.

@BeforeEach
void setUp() throws ConstructableRegistryException {
    MockitoAnnotations.initMocks(this);
    accountsLedger = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, backingAccounts, new ChangeSummaryManager<>());
    accountsLedger.setCommitInterceptor(accountsCommitInterceptor);
    tokenRelsLedger = new TransactionalLedger<>(TokenRelProperty.class, MerkleTokenRelStatus::new, backingRels, new ChangeSummaryManager<>());
    nftsLedger = new TransactionalLedger<>(NftProperty.class, MerkleUniqueToken::new, backingNfts, new ChangeSummaryManager<>());
    nftsLedger.setCommitInterceptor(uniqueTokensCommitInterceptor);
    tokenRelsLedger.setKeyToString(BackingTokenRels::readableTokenRel);
    tokenRelsLedger.setCommitInterceptor(tokenRelsCommitInterceptor);
    backingTokens.put(tokenKey.toGrpcTokenId(), fungibleTokenWithTreasury(aModel));
    backingTokens.put(anotherTokenKey.toGrpcTokenId(), fungibleTokenWithTreasury(aModel));
    backingTokens.put(yetAnotherTokenKey.toGrpcTokenId(), fungibleTokenWithTreasury(aModel));
    backingTokens.put(aNftKey.toGrpcTokenId(), nonFungibleTokenWithTreasury(aModel));
    backingTokens.put(bNftKey.toGrpcTokenId(), nonFungibleTokenWithTreasury(bModel));
    final var sideEffectsTracker = new SideEffectsTracker();
    tokenStore = new HederaTokenStore(ids, validator, sideEffectsTracker, dynamicProperties, tokenRelsLedger, nftsLedger, backingTokens);
    transferLogic = new TransferLogic(accountsLedger, nftsLedger, tokenRelsLedger, tokenStore, sideEffectsTracker, dynamicProperties, validator, autoCreationLogic, historian);
    tokenStore.rebuildViews();
    subject = new HederaLedger(tokenStore, ids, creator, validator, sideEffectsTracker, historian, dynamicProperties, accountsLedger, transferLogic, autoCreationLogic);
    subject.setMutableEntityAccess(mutableEntityAccess);
    subject.setTokenRelsLedger(tokenRelsLedger);
}
Also used : HederaTokenStore(com.hedera.services.store.tokens.HederaTokenStore) ChangeSummaryManager(com.hedera.services.ledger.properties.ChangeSummaryManager) SideEffectsTracker(com.hedera.services.context.SideEffectsTracker) NftProperty(com.hedera.services.ledger.properties.NftProperty) BackingTokenRels(com.hedera.services.ledger.backing.BackingTokenRels) HashMapBackingTokenRels(com.hedera.services.ledger.backing.HashMapBackingTokenRels) AccountProperty(com.hedera.services.ledger.properties.AccountProperty) TokenRelProperty(com.hedera.services.ledger.properties.TokenRelProperty) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with ChangeSummaryManager

use of com.hedera.services.ledger.properties.ChangeSummaryManager in project hedera-services by hashgraph.

the class LedgerImplBackingStoreTest method setUp.

@BeforeEach
void setUp() {
    backingTestAccounts = new HashMapTestAccounts();
    firstOrder = new TransactionalLedger<>(TestAccountProperty.class, TestAccount::new, backingTestAccounts, new ChangeSummaryManager<>());
}
Also used : ChangeSummaryManager(com.hedera.services.ledger.properties.ChangeSummaryManager) TestAccountProperty(com.hedera.services.ledger.properties.TestAccountProperty) HashMapTestAccounts(com.hedera.services.ledger.backing.HashMapTestAccounts) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with ChangeSummaryManager

use of com.hedera.services.ledger.properties.ChangeSummaryManager in project hedera-services by hashgraph.

the class HederaLedgerLiveTest method setup.

@BeforeEach
void setup() {
    commonSetup();
    accountsLedger = new TransactionalLedger<>(AccountProperty.class, MerkleAccount::new, new HashMapBackingAccounts(), new ChangeSummaryManager<>());
    accountsLedger.setCommitInterceptor(accountsCommitInterceptor);
    nftsLedger = new TransactionalLedger<>(NftProperty.class, MerkleUniqueToken::new, new HashMapBackingNfts(), new ChangeSummaryManager<>());
    nftsLedger.setCommitInterceptor(uniqueTokensCommitInterceptor);
    tokenRelsLedger = new TransactionalLedger<>(TokenRelProperty.class, MerkleTokenRelStatus::new, new HashMapBackingTokenRels(), new ChangeSummaryManager<>());
    tokenRelsLedger.setKeyToString(BackingTokenRels::readableTokenRel);
    tokenRelsLedger.setCommitInterceptor(tokenRelsCommitInterceptor);
    tokenStore = new HederaTokenStore(ids, TestContextValidator.TEST_VALIDATOR, liveSideEffects, new MockGlobalDynamicProps(), tokenRelsLedger, nftsLedger, new HashMapBackingTokens());
    subject = new HederaLedger(tokenStore, ids, creator, validator, liveSideEffects, historian, dynamicProps, accountsLedger, transferLogic, autoCreationLogic);
    subject.setMutableEntityAccess(mock(MutableEntityAccess.class));
}
Also used : HashMapBackingTokenRels(com.hedera.services.ledger.backing.HashMapBackingTokenRels) NftProperty(com.hedera.services.ledger.properties.NftProperty) BackingTokenRels(com.hedera.services.ledger.backing.BackingTokenRels) HashMapBackingTokenRels(com.hedera.services.ledger.backing.HashMapBackingTokenRels) AccountProperty(com.hedera.services.ledger.properties.AccountProperty) TokenRelProperty(com.hedera.services.ledger.properties.TokenRelProperty) HashMapBackingNfts(com.hedera.services.ledger.backing.HashMapBackingNfts) HederaTokenStore(com.hedera.services.store.tokens.HederaTokenStore) ChangeSummaryManager(com.hedera.services.ledger.properties.ChangeSummaryManager) HashMapBackingTokens(com.hedera.services.ledger.backing.HashMapBackingTokens) MockGlobalDynamicProps(com.hedera.services.config.MockGlobalDynamicProps) HashMapBackingAccounts(com.hedera.services.ledger.backing.HashMapBackingAccounts) MutableEntityAccess(com.hedera.services.store.contracts.MutableEntityAccess) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ChangeSummaryManager (com.hedera.services.ledger.properties.ChangeSummaryManager)4 BeforeEach (org.junit.jupiter.api.BeforeEach)4 AccountProperty (com.hedera.services.ledger.properties.AccountProperty)3 SideEffectsTracker (com.hedera.services.context.SideEffectsTracker)2 BackingTokenRels (com.hedera.services.ledger.backing.BackingTokenRels)2 HashMapBackingTokenRels (com.hedera.services.ledger.backing.HashMapBackingTokenRels)2 NftProperty (com.hedera.services.ledger.properties.NftProperty)2 TestAccountProperty (com.hedera.services.ledger.properties.TestAccountProperty)2 TokenRelProperty (com.hedera.services.ledger.properties.TokenRelProperty)2 HederaTokenStore (com.hedera.services.store.tokens.HederaTokenStore)2 MockGlobalDynamicProps (com.hedera.services.config.MockGlobalDynamicProps)1 HashMapBackingAccounts (com.hedera.services.ledger.backing.HashMapBackingAccounts)1 HashMapBackingNfts (com.hedera.services.ledger.backing.HashMapBackingNfts)1 HashMapBackingTokens (com.hedera.services.ledger.backing.HashMapBackingTokens)1 HashMapTestAccounts (com.hedera.services.ledger.backing.HashMapTestAccounts)1 TestAccountCommitInterceptor (com.hedera.services.ledger.properties.TestAccountCommitInterceptor)1 MutableEntityAccess (com.hedera.services.store.contracts.MutableEntityAccess)1