class RequestJournal extends RequestJournalReader with NamedLogging with HasFlushFuture

The request journal records the committed com.digitalasset.canton.participant.protocol.RequestJournal.RequestState! associated with particular requests. The request journal is only written to by the com.digitalasset.canton.participant.protocol.ProtocolProcessors. In particular, reads of request journal state are used for maintaining consistency in reads from contract stores. The request journal is also used for bookkeeping and recovery. The only exception to the writing rule is the com.digitalasset.canton.participant.store.RequestJournalStore.prune method, which may be user-triggered, though the call's pre-conditions must be respected.

The request journal uses two strategies to persistently organize states:

The head request for a state value is a com.digitalasset.canton.RequestCounter defined as follows:

  • Normally, the least request (ordering by request counter) which has not yet reached or progressed past that state value. However, the actual head may lag behind arbitrarily because the head is not updated atomically with the request states.
  • In the edge case where no such request exists in the journal, the head points to the first request counter that has not been added to the journal.

The prehead request is the request before the head request, or scala.None$ if there is no such request.

The request journal also stores the timestamp associated with the request. The assumption is made that every request is associated with only one timestamp. However, several requests may have the same timestamp.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RequestJournal
  2. HasFlushFuture
  3. NamedLogging
  4. RequestJournalReader
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RequestJournal(store: RequestJournalStore, metrics: SyncDomainMetrics, loggerFactory: NamedLoggerFactory, initRc: RequestCounter, futureSupervisor: FutureSupervisor)(implicit ec: ExecutionContext, closeContext: CloseContext)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addToFlushAndLogError(name: String)(future: Future[_])(implicit loggingContext: ErrorLoggingContext): Unit

    Adds the task future to the flush future so that doFlush completes only after future has completed.

    Adds the task future to the flush future so that doFlush completes only after future has completed. Logs an error if the future fails with an exception.

    Attributes
    protected
    Definition Classes
    HasFlushFuture
  5. def addToFlushWithoutLogging(name: String)(future: Future[_]): Unit

    Adds the task future to the flush future so that doFlush completes only after future has completed.

    Adds the task future to the flush future so that doFlush completes only after future has completed. The caller is responsible for logging any exceptions thrown inside the future.

    Attributes
    protected
    Definition Classes
    HasFlushFuture
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def doFlush(): Future[Unit]

    Returns a future that completes after all added futures have completed.

    Returns a future that completes after all added futures have completed. The returned future never fails.

    Attributes
    protected
    Definition Classes
    HasFlushFuture
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. implicit def errorLoggingContext(implicit traceContext: TraceContext): ErrorLoggingContext
    Attributes
    protected
    Definition Classes
    NamedLogging
  12. def flush(): Future[Unit]

    When the returned future completes, pending updates and deletions that have been initiated before the call will be performed such that they are visible to subsequent queries.

    When the returned future completes, pending updates and deletions that have been initiated before the call will be performed such that they are visible to subsequent queries. Prevents accidental deletion of subsequent reinsertion due to pending deletes.

    Annotations
    @VisibleForTesting()
  13. def flushCloseable(name: String, timeout: NonNegativeDuration): SyncCloseable
    Attributes
    protected
    Definition Classes
    HasFlushFuture
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def insert(rc: RequestCounter, requestTimestamp: CantonTimestamp)(implicit traceContext: TraceContext): Future[Unit]

    Insert a new request into the request journal.

    Insert a new request into the request journal. The insertion will become visible immediately. The request has the initial state RequestJournal.RequestState.Pending.

    Preconditions:

    • The request counter must not have been previously inserted.
    • The request counter must be at least the front value of pendingCursor.
    • The request counter must not be Long.MaxValue.
    rc

    The request counter for the request.

    requestTimestamp

    The timestamp on the request message.

    returns

    A future that will terminate as soon as the request has been stored or fail if a precondition is violated.

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def logger: TracedLogger
    Attributes
    protected
    Definition Classes
    NamedLogging
  19. val loggerFactory: NamedLoggerFactory
    Attributes
    protected
    Definition Classes
    RequestJournalNamedLogging
  20. implicit def namedLoggingContext(implicit traceContext: TraceContext): NamedLoggingContext
    Attributes
    protected
    Definition Classes
    NamedLogging
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def noTracingLogger: Logger
    Attributes
    protected
    Definition Classes
    NamedLogging
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def numberOfDirtyRequests: Int

    Yields the number of requests that are currently not in state clean.

    Yields the number of requests that are currently not in state clean.

    The number may be incorrect, if previous calls to insert or terminate have failed with an exception. This can be tolerated, as the SyncDomain should be restarted after such an exception and that will reset the request journal.

  26. def query(rc: RequestCounter)(implicit traceContext: TraceContext): OptionT[Future, RequestData]

    Returns the RequestJournal.RequestData associated with the given request counter, if any.

    Returns the RequestJournal.RequestData associated with the given request counter, if any. Modifications done through the RequestJournal interface show up eventually, not necessarily immediately.

    Definition Classes
    RequestJournalRequestJournalReader
  27. def size(start: CantonTimestamp = CantonTimestamp.Epoch, end: Option[CantonTimestamp] = None)(implicit traceContext: TraceContext): Future[Int]

    Counts requests whose timestamps lie between the given timestamps (inclusive).

    Counts requests whose timestamps lie between the given timestamps (inclusive).

    start

    Count all requests after or at the given timestamp

    end

    Count all requests before or at the given timestamp; use None to impose no upper limit

    Annotations
    @VisibleForTesting()
  28. def snapshotIncomplete: Seq[String]

    Returns the list of currently incomplete tasks.

    Returns the list of currently incomplete tasks. Use only for inspection and debugging.

    Definition Classes
    HasFlushFuture
  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def terminate(rc: RequestCounter, requestTimestamp: CantonTimestamp, commitTime: CantonTimestamp)(implicit traceContext: TraceContext): Future[Future[Unit]]

    Moves the given request to RequestJournal.RequestState.Clean and sets the commit time.

    Moves the given request to RequestJournal.RequestState.Clean and sets the commit time. Does nothing if the request was already clean.

    Preconditions:

    • The request counter rc is in this request journal with timestamp requestTimestamp.
    • The commit time must be after or at the request time of the request.
    • The methods insert and terminate are not called concurrently.
    requestTimestamp

    The timestamp assigned to the request counter

    returns

    A future that completes as soon as the state change has been persisted or fails if a precondition is violated. The future itself contains a future that completes as soon as the clean cursor reaches rc.

  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  34. 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
    Deprecated

Inherited from HasFlushFuture

Inherited from NamedLogging

Inherited from RequestJournalReader

Inherited from AnyRef

Inherited from Any

Ungrouped