com.digitalasset.canton.participant.store.memory
InMemoryMultiDomainEventLog
Companion object InMemoryMultiDomainEventLog
class InMemoryMultiDomainEventLog extends MultiDomainEventLog with FlagCloseable with NamedLogging
- Alphabetic
- By Inheritance
- InMemoryMultiDomainEventLog
- NamedLogging
- FlagCloseable
- MultiDomainEventLog
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new InMemoryMultiDomainEventLog(lookupEvent: (NamedLoggingContext) => (EventLogId, LocalOffset) => Future[TimestampedEventAndCausalChange], lookupOffsetsBetween: (NamedLoggingContext) => (EventLogId) => (LocalOffset, LocalOffset) => Future[Seq[LocalOffset]], byEventId: (NamedLoggingContext) => (EventId) => OptionT[Future, (EventLogId, LocalOffset)], clock: Clock, metrics: ParticipantMetrics, indexedStringStore: IndexedStringStore, timeouts: ProcessingTimeout, loggerFactory: NamedLoggerFactory)(implicit executionContext: ExecutionContext)
Type Members
- case class ReaderState(count: Int, readers: MultiSet[String]) extends Product with Serializable
- Definition Classes
- FlagCloseable
Value Members
- object ReaderState extends Serializable
- Definition Classes
- FlagCloseable
- 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- 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()
- def closingTimeout: FiniteDuration
- Attributes
- protected
- Definition Classes
- FlagCloseable
- 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
- implicit val executionContext: ExecutionContext
- Attributes
- protected
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def fetchUnpublished(id: EventLogId, upToInclusiveO: Option[LocalOffset])(implicit traceContext: TraceContext): Future[Seq[PendingPublish]]
Finds unpublished events in the single dimension event log.
Finds unpublished events in the single dimension event log. More precisely, finds all events from
id
with:- local offset strictly greater than the local offset of the last published event from
id
- local offset smaller than or equal to
upToInclusiveO
(if defined).
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- local offset strictly greater than the local offset of the last published event from
- def flush(): Future[Unit]
Returns a future that completes after all publications have happened whose publish future has completed before the call to flush.
Returns a future that completes after all publications have happened whose publish future has completed before the call to flush.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getOffsetByTimeAtOrAfter(fromInclusive: CantonTimestamp)(implicit traceContext: TraceContext): OptionT[Future, (GlobalOffset, EventLogId, LocalOffset)]
Yields the smallest global offset whose publication time is at or after
fromInclusive
, if any.Yields the smallest global offset whose publication time is at or after
fromInclusive
, if any. The publication time is measured on the participant's local clock.- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def getOffsetByTimeUpTo(upToInclusive: CantonTimestamp)(implicit traceContext: TraceContext): OptionT[Future, GlobalOffset]
Yields the largest global offset whose publication time is before or at
upToInclusive
, if any.Yields the largest global offset whose publication time is before or at
upToInclusive
, if any. The publication time is measured on the participant's local clock.- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def globalOffsetFor(eventLogId: EventLogId, localOffset: LocalOffset)(implicit traceContext: TraceContext): Future[Option[(GlobalOffset, CantonTimestamp)]]
Returns the com.digitalasset.canton.participant.GlobalOffset under which the given local offset of the given event log was published, if any, along with its publication time
Returns the com.digitalasset.canton.participant.GlobalOffset under which the given local offset of the given event log was published, if any, along with its publication time
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val indexedStringStore: IndexedStringStore
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def internalPerformUnlessClosingF[A](name: String)(f: => Future[A])(implicit ec: ExecutionContext, traceContext: TraceContext): UnlessShutdown[Future[A]]
- Attributes
- protected
- Definition Classes
- FlagCloseable
- 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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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
- def lastDomainOffsetsBeforeOrAtGlobalOffset(upToInclusive: GlobalOffset, domainIds: List[DomainId], participantEventLogId: ParticipantEventLogId)(implicit traceContext: TraceContext): Future[(Map[DomainId, LocalOffset], Option[LocalOffset])]
Yields the greatest local offsets for the underlying SingleDimensionEventLog with global offset less than or equal to
upToInclusive
.Yields the greatest local offsets for the underlying SingleDimensionEventLog with global offset less than or equal to
upToInclusive
.- returns
(domainLastOffsets, participantLastOffset)
, wheredomainLastOffsets
maps the domains indomainIds
to the greatest offset of the corresponding domain event log (if it exists) andparticipantLastOffset
is the greatest participant offset.
- Definition Classes
- MultiDomainEventLog
- def lastGlobalOffset(uptoInclusive: GlobalOffset = Long.MaxValue)(implicit traceContext: TraceContext): OptionT[Future, GlobalOffset]
Yields the highest global offset up to the given bound, if any.
Yields the highest global offset up to the given bound, if any.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def lastLocalOffset(id: EventLogId)(implicit traceContext: TraceContext): Future[Option[LocalOffset]]
Returns the last linearized com.digitalasset.canton.participant.LocalOffset for the SingleDimensionEventLog
id
, if anyReturns the last linearized com.digitalasset.canton.participant.LocalOffset for the SingleDimensionEventLog
id
, if any- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def lastLocalOffsetBeforeOrAt(eventLogId: EventLogId, upToInclusive: GlobalOffset, timestampInclusive: CantonTimestamp)(implicit traceContext: TraceContext): Future[Option[LocalOffset]]
Returns the greatest local offset of the SingleDimensionEventLog given by
eventLogId
, if any, such that the following holds:Returns the greatest local offset of the SingleDimensionEventLog given by
eventLogId
, if any, such that the following holds:- The assigned global offset is below or at
upToInclusive
. - The record time of the event is below or at
timestampInclusive
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- The assigned global offset is below or at
- def locateOffset(deltaFromBeginning: GlobalOffset)(implicit traceContext: TraceContext): OptionT[Future, GlobalOffset]
Yields the
deltaFromBeginning
-lowest global offset (if it exists).Yields the
deltaFromBeginning
-lowest global offset (if it exists). I.e.,locateOffset(0)
yields the smallest offset,localOffset(1)
the second smallest offset, and so on.- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Attributes
- protected
- Definition Classes
- InMemoryMultiDomainEventLog → NamedLogging
- def lookupByEventIds(eventIds: Seq[EventId])(implicit traceContext: TraceContext): Future[Map[EventId, (GlobalOffset, TimestampedEventAndCausalChange, CantonTimestamp)]]
Yields the global offset, event and publication time for all the published events with the given IDs.
Yields the global offset, event and publication time for all the published events with the given IDs. Unpublished events are ignored.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def lookupEventRange(upToInclusive: Option[GlobalOffset], limit: Option[Int])(implicit traceContext: TraceContext): Future[Seq[(GlobalOffset, TimestampedEventAndCausalChange)]]
Yields all events with offset up to
upToInclusive
.Yields all events with offset up to
upToInclusive
.- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def lookupOffset(globalOffset: GlobalOffset)(implicit traceContext: TraceContext): OptionT[Future, (EventLogId, LocalOffset, CantonTimestamp)]
Returns the data associated with the given offset, if any
Returns the data associated with the given offset, if any
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def lookupTransactionDomain(transactionId: LedgerTransactionId)(implicit traceContext: TraceContext): OptionT[Future, DomainId]
Find the domain of a committed transaction.
Find the domain of a committed transaction.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def maxSleepMillis: Long
- Attributes
- protected
- Definition Classes
- FlagCloseable
- 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() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def notifyOnPublish(published: Seq[Publication])(implicit traceContext: TraceContext): Unit
- Attributes
- protected
- Definition Classes
- MultiDomainEventLog
- def onClosed(): Unit
- Definition Classes
- InMemoryMultiDomainEventLog → FlagCloseable
- val onPublish: AtomicReference[OnPublish]
- Attributes
- protected
- Definition Classes
- MultiDomainEventLog
- 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 afterf
completes, but other tasks may execute concurrently withf
, 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 off
, 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
- 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. Bothetf
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 afteretf
completes, but other tasks may execute concurrently withetf
, 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 ofetf
, because it will result in a deadlock.- etf
The task to perform
- Definition Classes
- FlagCloseable
- 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
- def performUnlessClosingEitherU[E, R](name: String)(etf: => EitherT[Future, E, R])(implicit ec: ExecutionContext, traceContext: TraceContext): EitherT[FutureUnlessShutdown, E, R]
- Definition Classes
- FlagCloseable
- 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 afterf
completes, but other tasks may execute concurrently withf
, 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 off
, 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
- def performUnlessClosingUSF[A](name: String)(f: => FutureUnlessShutdown[A])(implicit ec: ExecutionContext, traceContext: TraceContext): FutureUnlessShutdown[A]
- Definition Classes
- FlagCloseable
- def prune(upToInclusive: GlobalOffset)(implicit traceContext: TraceContext): Future[Unit]
Removes all events with offset up to
upToInclusive
.Removes all events with offset up to
upToInclusive
.- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def publicationTimeLowerBound: CantonTimestamp
Returns a lower bound on the latest publication time of a published event.
Returns a lower bound on the latest publication time of a published event. All events published later will receive the same or higher publication time. Increases monotonically, even across restarts.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- def publish(data: PublicationData): Future[Unit]
Appends a new event to the event log.
Appends a new event to the event log.
The new event must already have been published in the SingleDimensionEventLog with id MultiDomainEventLog.PublicationData.eventLogId at offset MultiDomainEventLog.PublicationData.localOffset.
The method is idempotent, i.e., it does nothing, if it is called twice with the same com.digitalasset.canton.participant.store.EventLogId and com.digitalasset.canton.participant.LocalOffset.
The returned future completes already when the event has been successfully inserted into the internal (in-memory) inbox. Events will be persisted asynchronously. Actual publication has happened before a subsequent flush call's future completes.
The caller must await completion of the returned future before calling the method again. Otherwise, the method may fail with an exception or return a failed future. (This restriction arises, because some implementations will offer the event to an Akka source queue, and the number of concurrent offers for such queues is bounded.)
The event log will stall, i.e., log an error and refuse to publish further events in the following cases:
- If an event cannot be persisted, even after retrying.
- If events are published out of order, i.e.,
publish(id, o2).flatMap(_ => publish(id, o1))
witho1 < o2
. Exception: The event log will not stall in case of republication of previously published events, i.e.,publish(id, o1).flatMap(_ => publish(id, o2).flatMap(_ => publish(id, o1)))
will not stall the event log.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- 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
- def runStateChanged(waitingState: Boolean = false): Unit
- Attributes
- protected
- Definition Classes
- FlagCloseable
- Annotations
- @VisibleForTesting()
- def setOnPublish(newOnPublish: OnPublish): Unit
Sets the listener to be called whenever events are published to the multi-domain event log.
Sets the listener to be called whenever events are published to the multi-domain event log.
- Definition Classes
- MultiDomainEventLog
- def subscribe(beginWith: Option[GlobalOffset])(implicit tc: TraceContext): Source[(GlobalOffset, Traced[LedgerSyncEvent]), NotUsed]
Yields an akka source with all stored events, optionally starting from a given offset.
Yields an akka source with all stored events, optionally starting from a given offset.
- Definition Classes
- InMemoryMultiDomainEventLog → MultiDomainEventLog
- Exceptions thrown
java.lang.IllegalArgumentException
ifbeginWith
is lower than MultiDomainEventLog.ledgerFirstOffset.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val timeouts: ProcessingTimeout
- Attributes
- protected
- Definition Classes
- InMemoryMultiDomainEventLog → FlagCloseable
- 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])