introducing the Indexer (#1559)

This commit is contained in:
Gabor Aranyossy 2019-06-07 16:09:57 +02:00 committed by GitHub
parent 1f8c273263
commit 002266caab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 6 deletions

View File

@ -20,7 +20,10 @@ import com.digitalasset.platform.sandbox.banner.Banner
import com.digitalasset.platform.sandbox.config.{SandboxConfig, SandboxContext}
import com.digitalasset.platform.sandbox.metrics.MetricsManager
import com.digitalasset.platform.sandbox.services.SandboxResetService
import com.digitalasset.platform.sandbox.stores.ActiveContractsInMemory
import com.digitalasset.platform.sandbox.stores.{
ActiveContractsInMemory,
SandboxIndexAndWriteService
}
import com.digitalasset.platform.sandbox.stores.ledger.ScenarioLoader.LedgerEntryWithLedgerEndIncrement
import com.digitalasset.platform.sandbox.stores.ledger._
import com.digitalasset.platform.sandbox.stores.ledger.sql.SqlStartMode

View File

@ -0,0 +1,40 @@
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.platform.sandbox.stores
import akka.Done
import com.daml.ledger.participant.state.v2.ReadService
import scala.concurrent.Future
/**
* Establishes a feed for an IndexService implementation
*/
trait Indexer {
/**
* Subscribes to an instance of ReadService.
*
* @param readService the ReadService to subscribe to
* @param onError callback to signal error during feed processing
* @param onComplete callback fired only once at normal feed termination.
* @return a handle of IndexFeedHandle or a failed Future
*/
def subscribe(
readService: ReadService,
onError: Throwable => Unit,
onComplete: () => Unit): Future[IndexFeedHandle]
}
/** A handle with which one can stop a running indexing feed. */
trait IndexFeedHandle {
/**
* Asynchronously stops the running index feed.
*
* @return Done if success or a failed future in case of an error.
*/
def stop(): Future[Done]
}

View File

@ -1,7 +1,7 @@
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.digitalasset.platform.sandbox.stores.ledger
package com.digitalasset.platform.sandbox.stores
import java.time.Instant
import java.util.concurrent.{CompletableFuture, CompletionStage}
@ -34,8 +34,8 @@ import com.digitalasset.platform.common.util.{DirectExecutionContext => DEC}
import com.digitalasset.platform.participant.util.EventFilter
import com.digitalasset.platform.sandbox.metrics.MetricsManager
import com.digitalasset.platform.sandbox.stores.ledger.ScenarioLoader.LedgerEntryWithLedgerEndIncrement
import com.digitalasset.platform.sandbox.stores.ledger._
import com.digitalasset.platform.sandbox.stores.ledger.sql.SqlStartMode
import com.digitalasset.platform.sandbox.stores.{ActiveContracts, ActiveContractsInMemory}
import com.digitalasset.platform.server.api.validation.ErrorFactories
import com.digitalasset.platform.services.time.TimeModel
import org.slf4j.LoggerFactory

View File

@ -15,11 +15,11 @@ import com.digitalasset.platform.sandbox.config.DamlPackageContainer
import com.digitalasset.platform.sandbox.damle.SandboxTemplateStore
import com.digitalasset.platform.sandbox.metrics.MetricsManager
import com.digitalasset.platform.sandbox.services.ApiSubmissionService
import com.digitalasset.platform.sandbox.stores.ActiveContractsInMemory
import com.digitalasset.platform.sandbox.stores.ledger.{
CommandExecutorImpl,
import com.digitalasset.platform.sandbox.stores.{
ActiveContractsInMemory,
SandboxIndexAndWriteService
}
import com.digitalasset.platform.sandbox.stores.ledger.CommandExecutorImpl
import com.digitalasset.platform.server.api.validation.IdentifierResolver
import com.digitalasset.platform.services.time.TimeModel