class NaiveRequestTracker extends RequestTracker with NamedLogging with FlagCloseableAsync

The naive request tracker performs all its tasks (activeness check/timeout/finalization) sequentially. It accumulates all pending tasks in a priority queue and executes them as soon as the request tracker can progress to their associated timestamp. The execution happens asynchronously in the execution context ecForConflictDetection.

Requests are kept in memory from the call to NaiveRequestTracker!.addRequest until the finalization time or the timeout.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. NaiveRequestTracker
  2. FlagCloseableAsync
  3. FlagCloseable
  4. RequestTracker
  5. NamedLogging
  6. AutoCloseable
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new NaiveRequestTracker(initSc: SequencerCounter, initTimestamp: CantonTimestamp, conflictDetector: ConflictDetector, taskSchedulerMetrics: TaskSchedulerMetrics, timeouts: ProcessingTimeout, loggerFactory: NamedLoggerFactory)(implicit executionContext: ExecutionContext)

    initSc

    The first sequencer counter to be processed

    initTimestamp

    Only timestamps after this timestamp are allowed

Type Members

  1. case class ReaderState(count: Int, readers: MultiSet[String]) extends Product with Serializable
    Definition Classes
    FlagCloseable

Value Members

  1. object ReaderState extends Serializable
    Definition Classes
    FlagCloseable
  2. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  3. final def ##: Int
    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def addCommitSet(rc: RequestCounter, commitSet: Try[CommitSet])(implicit traceContext: TraceContext): Either[CommitSetError, EitherT[Future, NonEmptyChain[RequestTrackerStoreError], Unit]]

    Informs the request tracker of the effect of a request that is to be committed.

    Informs the request tracker of the effect of a request that is to be committed. The effect is described by a CommitSet, namely which contracts should be deactivated and which ones activated.

    This method may be called only after an addResult call for the same request.

    commitSet

    The commit set to describe the committed effect of the request A scala.util.Failure$ indicates that result processing failed and no commit set can be provided.

    returns

    A future to indicate whether the request was successfully finalized. When this future completes, the request's effect is persisted to the store.ActiveContractStore and the store.TransferStore. The future fails with an exception if the commit set tries to activate or deactivate a contract that was not locked during the activeness check. Otherwise, activeness irregularities are reported as scala.Left$.

    Definition Classes
    NaiveRequestTrackerRequestTracker
    See also

    ConflictDetector.finalizeRequest

  6. def addEmptyCommitSet(rc: RequestCounter)(implicit traceContext: TraceContext): Either[CommitSetError, Future[Unit]]

    Shorthand for addCommitSet(rc, CommitSet.empty)

    Shorthand for addCommitSet(rc, CommitSet.empty)

    Definition Classes
    RequestTracker
  7. def addRequest(rc: RequestCounter, sc: SequencerCounter, requestTimestamp: CantonTimestamp, activenessTimestamp: CantonTimestamp, decisionTime: CantonTimestamp, activenessSet: ActivenessSet)(implicit traceContext: TraceContext): Either[RequestAlreadyExists, Future[RequestFutures]]

    Adds the confirmation request to the request tracker.

    Adds the confirmation request to the request tracker. It schedules the activeness check for the activenessTime and the timeout of the request for the decisionTime, whereby a result exactly at the decisionTime is considered to be in time. If a scala.Right$ is returned, it also signals the arrival of the message with sequencerCounter and timestamp requestTimestamp, like the RequestTracker!.tick operation.

    The activeness check request is expressed as an activeness set comprising all the contracts that must be active and those that may be created or transferred-in. This operation returns a pair of futures indicating the outcome of the activeness check and the timeout state of the request, described below.

    If a request with requestCounter and sequencerCounter is added, the request tracker expects that eventually every request prior to requestCounter will be added, and that every sequencer counter prior to sequencerCounter will be signaled.

    If the request has been added before with the same parameters, but it is not yet finalized nor has it timed out, the method ignores the second call and returns the same futures as in the first call.

    requestTimestamp

    The timestamp on the request.

    decisionTime

    The timeout for the request. Must be after the activenessTime.

    activenessSet

    The activeness set that determines the checks at the activenessTime.

    returns

    scala.Right$ if the request was added successfully or this is a duplicate call for the request. One future for the result of the activeness check and one for signalling the timeout state of a request. These futures complete only when their result is determined: The result of the activeness check when the request tracker has progressed to the activenessTime. The timeout state when the request tracker has progressed to the decisionTime or a transaction result was added for the request. scala.Left$ if a request with the same requestCounter is in flight with different parameters.

    Definition Classes
    NaiveRequestTrackerRequestTracker
    Exceptions thrown

    • If the requestTimestamp or sequencerCounter is Long.MaxValue.
    • If the requestTimestamp is earlier than to where the request tracking has already progressed
    • If the activenessTimestamp is not between the requestTimestamp (inclusive) and the decisionTime (exclusive).
  8. def addResult(rc: RequestCounter, sc: SequencerCounter, resultTimestamp: CantonTimestamp, commitTime: CantonTimestamp)(implicit traceContext: TraceContext): Either[ResultError, Unit]

    Informs the request tracker that a result message has arrived for the given request.

    Informs the request tracker that a result message has arrived for the given request. This marks the request as not having timed out. The actual effect of the result must be supplied via a subsequent call to RequestTracker!.addCommitSet. The request tracker may not progress beyond the commitTime until the commit set is provided.

    This method may be called only after a RequestTracker!.addRequest call for the same request.

    resultTimestamp

    The timestamp of the result message. Must be after the request's timestamp and at most the decision time.

    commitTime

    The commit time, i.e., when the result takes effect Must be no earlier than the result timestamp.

    returns

    scala.Right$ if the result was added successfully or this is a duplicate call for the request. The timeout future returned by the corresponding call to RequestTracker!.addRequest completes with RequestTracker$.NoTimeout. scala.Left$ if the result could not be added (see the RequestTracker$.ResultErrors for the possible cases). The timestamp is nevertheless considered as observed.

    Definition Classes
    NaiveRequestTrackerRequestTracker
    Exceptions thrown

    java.lang.IllegalArgumentException if the commitTime is before the resultTimestamp, or if the request is in flight and the resultTimestamp is after its decision time. The timestamp is not observed in this case.

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def awaitTimestamp(timestamp: CantonTimestamp): Option[Future[Unit]]

    Returns a future that completes after the request has progressed to the given timestamp.

    Returns a future that completes after the request has progressed to the given timestamp. If the request tracker has already progressed to the timestamp, scala.None is returned.

    Definition Classes
    NaiveRequestTrackerRequestTracker
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  12. final def close(): Unit

    Blocks until all earlier tasks have completed and then prevents further tasks from being run.

    Blocks until all earlier tasks have completed and then prevents further tasks from being run.

    Definition Classes
    FlagCloseable → AutoCloseable
    Annotations
    @SuppressWarnings()
  13. def closeAsync(): Seq[AsyncOrSyncCloseable]

    closeAsync asynchronously releases resources held by a future

    closeAsync asynchronously releases resources held by a future

    returns

    an ordered sequence of async and sync closeables with async closeables made up of future and timeout

    Definition Classes
    NaiveRequestTrackerFlagCloseableAsync
  14. def closingTimeout: FiniteDuration
    Attributes
    protected
    Definition Classes
    FlagCloseable
  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  17. def getApproximateState(coid: LfContractId)(implicit traceContext: TraceContext): OptionT[Future, ContractState]

    Returns a possibly outdated state of the contract.

    Returns a possibly outdated state of the contract.

    Definition Classes
    NaiveRequestTrackerRequestTracker
  18. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. def internalPerformUnlessClosingF[A](name: String)(f: => Future[A])(implicit ec: ExecutionContext, traceContext: TraceContext): UnlessShutdown[Future[A]]
    Attributes
    protected
    Definition Classes
    FlagCloseable
  21. def isClosing: Boolean

    Check whether we're closing.

    Check whether we're closing. Susceptible to race conditions; unless you're using using this as a flag to the retry lib or you really know what you're doing, prefer performUnlessClosing and friends.

    Definition Classes
    FlagCloseable
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def keepTrackOfOpenFutures: Boolean

    track running futures on shutdown

    track running futures on shutdown

    set to true to get detailed information about all futures that did not complete during shutdown. if set to false, we don't do anything.

    Attributes
    protected
    Definition Classes
    FlagCloseable
  24. def logger: TracedLogger
    Attributes
    protected
    Definition Classes
    NamedLogging
  25. val loggerFactory: NamedLoggerFactory
    Attributes
    protected
    Definition Classes
    NaiveRequestTrackerNamedLogging
  26. implicit def loggingContext(implicit traceContext: TraceContext): ErrorLoggingContext
    Attributes
    protected
    Definition Classes
    NamedLogging
  27. def maxSleepMillis: Long
    Attributes
    protected
    Definition Classes
    FlagCloseable
  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def noTracingLogger: Logger
    Attributes
    protected
    Definition Classes
    NamedLogging
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  32. final def onClosed(): Unit
    Definition Classes
    FlagCloseableAsyncFlagCloseable
  33. def performUnlessClosing[A](name: String)(f: => A)(implicit traceContext: TraceContext): UnlessShutdown[A]

    Performs the task given by f unless a shutdown has been initiated.

    Performs the task given by f unless a shutdown has been initiated. The shutdown will only begin after f completes, but other tasks may execute concurrently with f, if started using this function, or one of the other variants (performUnlessClosingF and performUnlessClosingEitherT). The tasks are assumed to take less than closingTimeout to complete.

    DO NOT CALL this.close as part of f, because it will result in a deadlock.

    f

    The task to perform

    returns

    scala.None$ if a shutdown has been initiated. Otherwise the result of the task.

    Definition Classes
    FlagCloseable
  34. def performUnlessClosingEitherT[E, R](name: String, onClosing: => E)(etf: => EitherT[Future, E, R])(implicit ec: ExecutionContext, traceContext: TraceContext): EitherT[Future, E, R]

    Performs the EitherT[Future] given by etf unless a shutdown has been initiated, in which case the provided error is returned instead.

    Performs the EitherT[Future] given by etf unless a shutdown has been initiated, in which case the provided error is returned instead. Both etf and the error are lazy; etf is only evaluated if there is no shutdown, the error only if we're shutting down. The shutdown will only begin after etf completes, but other tasks may execute concurrently with etf, if started using this function, or one of the other variants (performUnlessClosing and performUnlessClosingF). The tasks are assumed to take less than closingTimeout to complete.

    DO NOT CALL this.close as part of etf, because it will result in a deadlock.

    etf

    The task to perform

    Definition Classes
    FlagCloseable
  35. def performUnlessClosingEitherTF[E, R](name: String, onClosing: => E)(etf: => EitherT[Future, E, Future[R]])(implicit ec: ExecutionContext, traceContext: TraceContext): EitherT[Future, E, Future[R]]
    Definition Classes
    FlagCloseable
  36. def performUnlessClosingF[A](name: String)(f: => Future[A])(implicit ec: ExecutionContext, traceContext: TraceContext): FutureUnlessShutdown[A]

    Performs the Future given by f unless a shutdown has been initiated.

    Performs the Future given by f unless a shutdown has been initiated. The future is lazy and not evaluated during shutdown. The shutdown will only begin after f completes, but other tasks may execute concurrently with f, if started using this function, or one of the other variants (performUnlessClosing and performUnlessClosingEitherT). The tasks are assumed to take less than closingTimeout to complete.

    DO NOT CALL this.close as part of f, because it will result in a deadlock.

    f

    The task to perform

    returns

    The future completes with com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if a shutdown has been initiated. Otherwise the result of the task wrapped in com.digitalasset.canton.lifecycle.UnlessShutdown.Outcome.

    Definition Classes
    FlagCloseable
  37. def requestInFlight(rc: RequestCounter): Boolean

    Returns whether the request is in flight, i.e., in the requests map.

    Returns whether the request is in flight, i.e., in the requests map.

    Annotations
    @VisibleForTesting()
  38. def runOnShutdown[T](task: RunOnShutdown)(implicit traceContext: TraceContext): Unit

    Register a task that will run onClose after all "performUnlessShutdown" tasks have finished

    Register a task that will run onClose after all "performUnlessShutdown" tasks have finished

    Definition Classes
    FlagCloseable
  39. def runStateChanged(waitingState: Boolean = false): Unit
    Attributes
    protected
    Definition Classes
    FlagCloseable
    Annotations
    @VisibleForTesting()
  40. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  41. def tick(sc: SequencerCounter, timestamp: CantonTimestamp)(implicit traceContext: TraceContext): Unit

    Tells the request tracker that a message with the given sequencer counter and timestamp has been received.

    Tells the request tracker that a message with the given sequencer counter and timestamp has been received.

    If RequestTracker!.addRequest or RequestTracker!.addResult shall be called for the same message, RequestTracker!.tick may only be called after those methods as they may schedule tasks at the timestamp or later and task scheduling for a timestamp must be done before the time is observed.

    A given sequencer counter may be signalled several times provided that all calls signal the same timestamp. Only the first such call is taken into account. Since RequestTracker!.addRequest and RequestTracker!.addResult implicitly signal the sequencer counter and timestamp to the request tracker (unless specified otherwise), it is safe to call this method after calling these methods.

    The timestamps must increase with the sequencer counters.

    timestamp

    The timestamp on the message.

    Definition Classes
    NaiveRequestTrackerRequestTracker
    Exceptions thrown

    If one of the following conditions hold:

    • If sequencerCounter is Long.MaxValue.
    • If not all sequencer counters below sequencerCounter have been signalled and the timestamp does not increase with sequencer counters.
    • If all sequencer counters below sequencerCounter have been signalled and the timestamp is at most the timestamp of an earlier sequencer counter.
    • If sequencerCounter has been signalled before with a different timestamp and not all sequencer counters below sequencerCounter have been signalled.
  42. val timeouts: ProcessingTimeout
    Attributes
    protected
    Definition Classes
    NaiveRequestTrackerFlagCloseable
  43. def toString(): String
    Definition Classes
    AnyRef → Any
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from FlagCloseableAsync

Inherited from FlagCloseable

Inherited from RequestTracker

Inherited from NamedLogging

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped