-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ledger-api-bench-tool - flexible stream filters [DPP-667] (#11458)
* ACS filters * Moved filters to a separate object * Filters for transactions and transaction trees streams * Updated help CHANGELOG_BEGIN - [Integration Kit] - ledger-api-bench-tool - added flexible party and template filters for transactions, transaction trees and active contract streams CHANGELOG_END * Changed filter separators to + and @
- Loading branch information
Showing
5 changed files
with
77 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...-api-bench-tool/src/main/scala/com/daml/ledger/api/benchtool/services/StreamFilters.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.api.benchtool.services | ||
|
||
import com.daml.ledger.api.v1.transaction_filter.{Filters, InclusiveFilters, TransactionFilter} | ||
import com.daml.ledger.api.v1.value.Identifier | ||
|
||
object StreamFilters { | ||
|
||
def transactionFilters( | ||
filters: Map[String, Option[List[Identifier]]] | ||
): TransactionFilter = { | ||
val byParty: Map[String, Filters] = filters.map { | ||
case (party, Some(templateIds)) => | ||
party -> Filters.defaultInstance.withInclusive( | ||
InclusiveFilters.defaultInstance.addAllTemplateIds(templateIds) | ||
) | ||
case (party, None) => | ||
party -> Filters.defaultInstance | ||
} | ||
|
||
TransactionFilter.defaultInstance.withFiltersByParty(byParty) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters