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:
- For every request, which is identified by a participant-local request counter, the request journal records the com.digitalasset.canton.participant.protocol.RequestJournal.RequestState associated with the request counter.
- For com.digitalasset.canton.participant.protocol.RequestJournal.RequestStateWithCursor states, a cursor tracks the head request for that state.
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.
- Alphabetic
- By Inheritance
- RequestJournal
- HasFlushFuture
- NamedLogging
- RequestJournalReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RequestJournal(store: RequestJournalStore, metrics: SyncDomainMetrics, loggerFactory: NamedLoggerFactory, initRc: RequestCounter, futureSupervisor: FutureSupervisor)(implicit ec: ExecutionContext, closeContext: CloseContext)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addToFlushAndLogError(name: String)(future: Future[_])(implicit loggingContext: ErrorLoggingContext): Unit
Adds the task
future
to the flush future so that doFlush completes only afterfuture
has completed.Adds the task
future
to the flush future so that doFlush completes only afterfuture
has completed. Logs an error if thefuture
fails with an exception.- Attributes
- protected
- Definition Classes
- HasFlushFuture
- def addToFlushWithoutLogging(name: String)(future: Future[_]): Unit
Adds the task
future
to the flush future so that doFlush completes only afterfuture
has completed.Adds the task
future
to the flush future so that doFlush completes only afterfuture
has completed. The caller is responsible for logging any exceptions thrown inside the future.- Attributes
- protected
- Definition Classes
- HasFlushFuture
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- implicit def errorLoggingContext(implicit traceContext: TraceContext): ErrorLoggingContext
- Attributes
- protected
- Definition Classes
- NamedLogging
- 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()
- def flushCloseable(name: String, timeout: NonNegativeDuration): SyncCloseable
- Attributes
- protected
- Definition Classes
- HasFlushFuture
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- 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.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Attributes
- protected
- Definition Classes
- RequestJournal → NamedLogging
- implicit def namedLoggingContext(implicit traceContext: TraceContext): NamedLoggingContext
- Attributes
- protected
- Definition Classes
- NamedLogging
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noTracingLogger: Logger
- Attributes
- protected
- Definition Classes
- NamedLogging
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- 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
orterminate
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. - 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
- RequestJournal → RequestJournalReader
- 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()
- 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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- 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:
- 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
.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])