trait MultiDomainEventLog extends AutoCloseable
The multi domain event log merges the events from several SingleDimensionEventLogs to a single event stream.
The underlying SingleDimensionEventLog either refer to a domain ("domain event log") or to the underlying participant ("participant event log").
Ordering guarantees: 1. Events belonging to the same SingleDimensionEventLog have the same relative order in the MultiDomainEventLog 2. Events are globally ordered such that any two (unpruned) events appear in the same relative order in different subscriptions and lookups.
- Self Type
- MultiDomainEventLog with NamedLogging
- Alphabetic
- By Inheritance
- MultiDomainEventLog
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def close(): Unit
- Definition Classes
- AutoCloseable
- Annotations
- @throws(classOf[java.lang.Exception])
- implicit abstract def executionContext: ExecutionContext
- Attributes
- protected
- abstract 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).
- local offset strictly greater than the local offset of the last published event from
- abstract def flush(): Future[Unit]
Returns a future that completes after all publications have happened whose publish future has completed before the call to flush.
- abstract 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. - abstract 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. - abstract 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
- abstract def indexedStringStore: IndexedStringStore
- abstract def lastGlobalOffset(upToInclusive: GlobalOffset = Long.MaxValue)(implicit traceContext: TraceContext): OptionT[Future, GlobalOffset]
Yields the highest global offset up to the given bound, if any.
- abstract def lastLocalOffset(id: EventLogId)(implicit traceContext: TraceContext): Future[Option[LocalOffset]]
Returns the last linearized com.digitalasset.canton.participant.LocalOffset for the SingleDimensionEventLog
id
, if any - abstract 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
- The assigned global offset is below or at
- abstract def locateOffset(deltaFromBeginning: Long)(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. - abstract 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.
- abstract def lookupEventRange(upToInclusive: Option[GlobalOffset], limit: Option[Int])(implicit traceContext: TraceContext): Future[Seq[(GlobalOffset, TimestampedEventAndCausalChange)]]
Yields all events with offset up to
upToInclusive
. - abstract def lookupOffset(globalOffset: GlobalOffset)(implicit traceContext: TraceContext): OptionT[Future, (EventLogId, LocalOffset, CantonTimestamp)]
Returns the data associated with the given offset, if any
- abstract def lookupTransactionDomain(transactionId: LedgerTransactionId)(implicit traceContext: TraceContext): OptionT[Future, DomainId]
Find the domain of a committed transaction.
- abstract def prune(upToInclusive: GlobalOffset)(implicit traceContext: TraceContext): Future[Unit]
Removes all events with offset up to
upToInclusive
. - abstract 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.
- abstract 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.
- abstract def subscribe(beginWith: Option[GlobalOffset])(implicit traceContext: 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.
- Exceptions thrown
java.lang.IllegalArgumentException
ifbeginWith
is lower than MultiDomainEventLog.ledgerFirstOffset.
Concrete 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
- 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 eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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
- val onPublish: AtomicReference[OnPublish]
- Attributes
- protected
- def setOnPublish(newOnPublish: OnPublish): Unit
Sets the listener to be called whenever events are published to the multi-domain event log.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- 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])