class DbSequencerBlockStore extends SequencerBlockStore with DbStore
- Alphabetic
- By Inheritance
- DbSequencerBlockStore
- DbStore
- HasCloseContext
- PromiseUnlessShutdownFactory
- NamedLogging
- FlagCloseable
- PerformUnlessClosing
- OnShutdownRunner
- SequencerBlockStore
- AutoCloseable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new DbSequencerBlockStore(storage: DbStorage, protocolVersion: ProtocolVersion, timeouts: ProcessingTimeout, checkedInvariant: Option[Member], loggerFactory: NamedLoggerFactory)(implicit executionContext: ExecutionContext)
- checkedInvariant
Defines whether all methods should check the block invariant when they modify the state. Invariant checking is slow. It should only be enabled for testing and debugging. scala.Some$ defines the member under whom the sequencer's topology client subscribes.
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 blockInvariant(topologyClientMember: Member, currentBlock: BlockInfo, prevBlockO: Option[BlockInfo], allEventsInBlock: Map[Member, NonEmpty[Seq[OrdinarySerializedEvent]]], newMembersInBlock: Iterable[(Member, CantonTimestamp)])(implicit traceContext: TraceContext): Unit
Check the invariant for a block in the store:
Check the invariant for a block in the store:
- If the previous block is defined, then its block height is
currentBlock.height - 1
. - If the previous block is defined, then its com.digitalasset.canton.domain.block.data.BlockInfo.lastTs of the the com.digitalasset.canton.domain.block.data.BlockEphemeralState is no later than the one of the current block. If there are neither events nor registrations in the current block, the two are equal.
- If the previous block is defined, the com.digitalasset.canton.domain.block.data.BlockInfo.latestTopologyClientTimestamp of the its com.digitalasset.canton.domain.block.data.BlockEphemeralState is no later than the one of the current block. In particular, if com.digitalasset.canton.domain.block.data.BlockInfo.latestTopologyClientTimestamp is defined in the previous block, then so is it in the successor block. If it is defined in the successor block, then it is the same as in the predecessor block unless the block contains events addressed to the sequencer's topology client.
- All events and member registrations in the current block are ealier or equal to the blocks' com.digitalasset.canton.domain.block.data.BlockInfo.lastTs. com.digitalasset.canton.domain.block.data.BlockInfo.lastTs is equal to the latest timestamp of an event or member registration in the block, unless the previous block is undefined and the block contains member registrations.
- All events in the block addressed to the
topologyClientMember
have timestamps of at most com.digitalasset.canton.domain.block.data.BlockInfo.latestTopologyClientTimestamp of the current block.
- topologyClientMember
The member under whom the sequencer's topology client subscribes
- currentBlock
The block info of the current block
- prevBlockO
The block info of the block preceding the
currentBlock
, unless the current block is the initial state- allEventsInBlock
All events in the current block
- newMembersInBlock
All member registrations that happened in the block i.e., at
currentBlock
's com.digitalasset.canton.domain.block.data.BlockInfo.lastTs.
- Attributes
- protected
- Definition Classes
- SequencerBlockStore
- Exceptions thrown
java.lang.IllegalStateException
if the invariant is violated
- If the previous block is defined, then its block height is
- def cancelShutdownTask(token: Long): Unit
Removes a shutdown task from the list using a token returned by runOnShutdown
Removes a shutdown task from the list using a token returned by runOnShutdown
- Definition Classes
- OnShutdownRunner
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- 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 → OnShutdownRunner → AutoCloseable
- implicit val closeContext: CloseContext
- Definition Classes
- HasCloseContext
- def closingTimeout: FiniteDuration
- Attributes
- protected
- Definition Classes
- FlagCloseable → PerformUnlessClosing
- def containsShutdownTask(token: Long): Boolean
- Definition Classes
- OnShutdownRunner
- 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
- DbSequencerBlockStore → SequencerBlockStore
- def finalizeBlockUpdate(block: BlockInfo)(implicit traceContext: TraceContext): Future[Unit]
Finalizes the current block whose updates have been added in the calls to partialBlockUpdate since the last call to finalizeBlockUpdate.
Finalizes the current block whose updates have been added in the calls to partialBlockUpdate since the last call to finalizeBlockUpdate.
This method must not be called concurrently with itself or partialBlockUpdate, and must be called for the blocks in monotonically increasing order of height.
- block
The block information about the current block. It is the responsibility of the caller to ensure that the height increases monotonically by one
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def getInitialState(implicit traceContext: TraceContext): Future[BlockEphemeralState]
Get initial state from which this sequencer node supports serving requests.
Get initial state from which this sequencer node supports serving requests. The member counters returned as part of this initial state indicate the minimum counters that this sequencer supports serving requests from. If a member is not included in these counters, it means that this sequencer node supports serving requests from the com.digitalasset.canton.data.CounterCompanion.Genesis for that member.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def getInitialTopologySnapshotTimestamp(implicit traceContext: TraceContext): Future[Option[CantonTimestamp]]
Retrieve the timestamp of the initial topology snapshot if available.
Retrieve the timestamp of the initial topology snapshot if available.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def internalPerformUnlessClosingF[A](name: String)(f: => Future[A])(implicit ec: ExecutionContext, traceContext: TraceContext): UnlessShutdown[Future[A]]
- Attributes
- protected
- Definition Classes
- PerformUnlessClosing
- def isClosing: Boolean
Check whether we're closing.
Check whether we're closing. Susceptible to race conditions; unless you're using this as a flag to the retry lib or you really know what you're doing, prefer
performUnlessClosing
and friends.- Definition Classes
- OnShutdownRunner
- 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
- PerformUnlessClosing
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Attributes
- protected
- Definition Classes
- DbSequencerBlockStore → NamedLogging
- def maxSleepMillis: Long
How often to poll to check that all tasks have completed.
How often to poll to check that all tasks have completed.
- Attributes
- protected
- Definition Classes
- PerformUnlessClosing
- def mkPromise[A](description: String, futureSupervisor: FutureSupervisor, logAfter: Duration = 10.seconds, logLevel: Level = Level.DEBUG)(implicit elc: ErrorLoggingContext, ec: ExecutionContext): PromiseUnlessShutdown[A]
Use this method to create a PromiseUnlessShutdown that will automatically be cancelled when the close context is closed.
Use this method to create a PromiseUnlessShutdown that will automatically be cancelled when the close context is closed. This allows proper clean up of stray promises when the node is transitioning to a passive state.
Note: you should *not* invoke
success
on the returned promise but rather usetrySuccess
. The reason is that the call tosuccess
may fail in case of shutdown.- Definition Classes
- PromiseUnlessShutdownFactory
- 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 onCloseFailure(e: Throwable): Unit
- Attributes
- protected
- Definition Classes
- PerformUnlessClosing
- def onClosed(): Unit
- Attributes
- protected
- Definition Classes
- PerformUnlessClosing
- final def onFirstClose(): 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
- PerformUnlessClosing → OnShutdownRunner
- Annotations
- @SuppressWarnings()
- def partialBlockUpdate(newMembers: MemberTimestamps, events: Seq[MemberSignedEvents], acknowledgments: MemberTimestamps, membersDisabled: Seq[Member], trafficState: Map[Member, TrafficState])(implicit traceContext: TraceContext): Future[Unit]
Stores some updates that happen in a single block.
Stores some updates that happen in a single block. May be called several times for the same block and the same update may be contained in several of the calls. Before adding updates of a subsequent block, finalizeBlockUpdate must be called to wrap up the current block.
This method must not be called concurrently with itself or finalizeBlockUpdate.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- 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
- PerformUnlessClosing
- def performUnlessClosingCheckedT[A, N, R](name: String, onClosing: => Checked[A, N, R])(etf: => CheckedT[Future, A, N, R])(implicit ec: ExecutionContext, traceContext: TraceContext): CheckedT[Future, A, N, R]
- Definition Classes
- PerformUnlessClosing
- 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
- PerformUnlessClosing
- 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
- PerformUnlessClosing
- def performUnlessClosingEitherU[E, R](name: String)(etf: => EitherT[Future, E, R])(implicit ec: ExecutionContext, traceContext: TraceContext): EitherT[FutureUnlessShutdown, E, R]
- Definition Classes
- PerformUnlessClosing
- def performUnlessClosingEitherUSF[E, R](name: String)(etf: => EitherT[FutureUnlessShutdown, E, R])(implicit ec: ExecutionContext, traceContext: TraceContext): EitherT[FutureUnlessShutdown, E, R]
- Definition Classes
- PerformUnlessClosing
- 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
- PerformUnlessClosing
- def performUnlessClosingUSF[A](name: String)(f: => FutureUnlessShutdown[A])(implicit ec: ExecutionContext, traceContext: TraceContext): FutureUnlessShutdown[A]
- Definition Classes
- PerformUnlessClosing
- def prune(requestedTimestamp: CantonTimestamp)(implicit traceContext: TraceContext): Future[String]
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def pruningStatus()(implicit traceContext: TraceContext): Future[InternalSequencerPruningStatus]
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def readHead(implicit traceContext: TraceContext): Future[BlockEphemeralState]
The current state of the sequencer, which can be used when the node is restarted to deterministically derive the following counters and timestamps.
The current state of the sequencer, which can be used when the node is restarted to deterministically derive the following counters and timestamps.
The state excludes updates of unfinalized blocks added with partialBlockUpdate.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def readRange(member: Member, startInclusive: SequencerCounter, endExclusive: SequencerCounter)(implicit traceContext: TraceContext): Source[OrdinarySerializedEvent, NotUsed]
Serve events (or tombstones) for member with the given counter range.
Serve events (or tombstones) for member with the given counter range.
The returned range may include events added with partialBlockUpdate even before the corresponding block has been finalized with finalizeBlockUpdate. This ensures that com.digitalasset.canton.sequencing.client.SequencerClients can immediately read events when they are added. In particular, the sequencer's com.digitalasset.canton.topology.client.DomainTopologyClient will see such updates so that block processing can request a com.digitalasset.canton.topology.client.TopologySnapshot that includes the updates in a block while processing continues for the same block.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def readStateForBlockContainingTimestamp(timestamp: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[Future, InvalidTimestamp, BlockEphemeralState]
The state at the end of the block that contains the given timestamp.
The state at the end of the block that contains the given timestamp. This will typically be used to inform other sequencer nodes being initialized of the initial state they should use based on the timestamp they provide which is typically the timestamp of their signing key.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- def runOnShutdown[T](task: RunOnShutdown)(implicit traceContext: TraceContext): Long
Same as runOnShutdown_ but returns a token that allows you to remove the task explicitly from being run using cancelShutdownTask
Same as runOnShutdown_ but returns a token that allows you to remove the task explicitly from being run using cancelShutdownTask
- Definition Classes
- OnShutdownRunner
- def runOnShutdown_[T](task: RunOnShutdown)(implicit traceContext: TraceContext): Unit
Register a task to run when shutdown is initiated.
Register a task to run when shutdown is initiated.
You can use this for example to register tasks that cancel long-running computations, whose termination you can then wait for in "closeAsync".
- Definition Classes
- OnShutdownRunner
- def runStateChanged(waitingState: Boolean = false): Unit
- Attributes
- protected
- Definition Classes
- OnShutdownRunner
- Annotations
- @VisibleForTesting()
- def setInitialState(initial: BlockEphemeralState, maybeOnboardingTopologyEffectiveTimestamp: Option[CantonTimestamp])(implicit traceContext: TraceContext): Future[Unit]
Set initial state of the sequencer node from which it supports serving requests.
Set initial state of the sequencer node from which it supports serving requests. This should be called at most once. If not called, it means this sequencer node can server requests from genesis.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- val storage: DbStorage
- Attributes
- protected
- Definition Classes
- DbSequencerBlockStore → DbStore
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val timeouts: ProcessingTimeout
- Attributes
- protected
- Definition Classes
- DbSequencerBlockStore → FlagCloseable
- def toString(): String
- Definition Classes
- AnyRef → Any
- def updateMemberCounterSupportedAfter(member: Member, counterLastUnsupported: SequencerCounter)(implicit traceContext: TraceContext): Future[Unit]
Updates the last unsupported member sequencer counter, i.e.
Updates the last unsupported member sequencer counter, i.e. the one just before the first supported sequencer counter. Only ever increases counter.
- Definition Classes
- DbSequencerBlockStore → SequencerBlockStore
- 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])