package sequencing
- Alphabetic
- By Inheritance
- sequencing
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- trait ApplicationHandler[-Box[+_ <: Envelope[_]], -Env <: Envelope[_]] extends (BoxedEnvelope[Box, Env]) => HandlerResult
An application handler processes boxed envelopes and returns a HandlerResult
- class ApplicationHandlerPekko[F[+_], Context] extends NamedLogging
Converts an com.digitalasset.canton.sequencing.ApplicationHandler into a Pekko flow.
- final case class AsyncResult[T](unwrap: FutureUnlessShutdown[T]) extends Product with Serializable
The asynchronous part of processing an event (or of a stage of its processing).
The asynchronous part of processing an event (or of a stage of its processing).
- Annotations
- @DoNotDiscardLikeFuture()
- type BoxedEnvelope[+Box[+_ <: Envelope[_]], +Env <: Envelope[_]] = Box[Env]
It is convenient to consider the envelopes and all the structure around the envelopes (the box).
It is convenient to consider the envelopes and all the structure around the envelopes (the box). EnvelopeBox defines type class operations to manipulate
- class ConnectionValidationLimiter extends AutoCloseable with NamedLogging
Small state machine to handle potential bursts of validations caused by rapidly flipping states of the underlying connection.
Small state machine to handle potential bursts of validations caused by rapidly flipping states of the underlying connection. If a validation is requested while one is being run, we schedule a new validation to start when the current one completes. Extra requests are collapsed into this single scheduling.
request request ┌───────────┐ validation ┌───────────┐ validation ┌───────────┐ │ IDLE ├────────────────►VALIDATING ├──────────────────►VALIDATION ├────┐ ├───────────┤ ├───────────┤ │ PENDING │ │ request │ │ │ on entry/ │ ├───────────┤ │validation │ │ │ start │ │ │ │ │ ◄────────────────┤validation ◄──────────────────┤ ◄────┘ └───────────┘ validation └───────────┘ validation └───────────┘ complete complete
- trait ConnectionX extends FlagCloseable with NamedLogging
A generic connection.
A generic connection. This trait attempts to be independent of the underlying transport.
NOTE: We currently make only a minimal effort to keep transport independence, and there are obvious leaks. This will be extended when we need it.
- class DelayLogger extends AnyRef
Wrapper for a sequencer subscription event handler that will log warnings if the timestamps of received messages appear significantly behind this consumer's clock.
- trait EnvelopeBox[Box[+_ <: Envelope[_]]] extends AnyRef
Type class to manipulate envelopes inside their box.
Type class to manipulate envelopes inside their box. Specializes cats.Traverse to protocol.Envelope arguments.
- final case class GrpcConnectionX(config: ConnectionXConfig, timeouts: ProcessingTimeout, loggerFactory: NamedLoggerFactory)(implicit ec: ExecutionContextExecutor) extends ConnectionX with PrettyPrinting with Product with Serializable
Connection specialized for gRPC transport.
- class GrpcInternalSequencerConnectionX extends InternalSequencerConnectionX with PrettyPrinting with GrpcClientTransportHelpers
Sequencer connection specialized for gRPC transport.
- class GrpcInternalSequencerConnectionXFactory extends InternalSequencerConnectionXFactory
- final case class GrpcSequencerConnection(endpoints: NonEmpty[Seq[Endpoint]], transportSecurity: Boolean, customTrustCertificates: Option[ByteString], sequencerAlias: SequencerAlias) extends SequencerConnection with Product with Serializable
- class GrpcSequencerConnectionX extends SequencerConnectionX with PrettyPrinting with GrpcClientTransportHelpers
Sequencer connection specialized for gRPC transport.
- class GrpcSequencerConnectionXStub extends SequencerConnectionXStub
Stub to interact with a sequencer, specialized for gRPC transport.
- class GrpcUserSequencerConnectionXStub extends UserSequencerConnectionXStub
Stub for user interactions with a sequencer, specialized for gRPC transport.
- type HandlerResult = FutureUnlessShutdown[AsyncResult[Unit]]
A handler processes an event synchronously in the scala.concurrent.Future and returns an AsyncResult that may be computed asynchronously by the contained future.
A handler processes an event synchronously in the scala.concurrent.Future and returns an AsyncResult that may be computed asynchronously by the contained future. Asynchronous processing may run concurrently with later events' synchronous processing and with asynchronous processing of other events.
- trait InternalSequencerConnectionX extends FlagCloseable with NamedLogging
A generic connection to a sequencer.
A generic connection to a sequencer. This trait attempts to be independent of the underlying transport.
This is an internal class used by the connection pool. Other components are expected to interact with the sequencer using the higher-level SequencerConnectionX.
NOTE: We currently make only a minimal effort to keep transport independence, and there are obvious leaks. This will be extended when we need it.
- trait InternalSequencerConnectionXFactory extends AnyRef
- type OrdinaryApplicationHandler[-E <: Envelope[_]] = ApplicationHandler[OrdinaryEnvelopeBox, E]
- type OrdinaryEnvelopeBox[+E <: Envelope[_]] = Traced[Seq[OrdinarySequencedEvent[E]]]
Default box for signed batches of events The outer
Traced
contains a trace context for the entire batch. - type OrdinaryEventHandler[Err] = (OrdinarySerializedEvent) => FutureUnlessShutdown[Either[Err, Unit]]
Default type for handlers on serialized events with error reporting
- type OrdinaryEventOrError = Either[SequencedEventError, OrdinarySerializedEvent]
- type OrdinaryEventOrErrorHandler[Err] = (OrdinaryEventOrError) => FutureUnlessShutdown[Either[Err, Unit]]
- type OrdinaryProtocolEvent = OrdinarySequencedEvent[DefaultOpenEnvelope]
- type OrdinarySerializedEvent = OrdinarySequencedEvent[ClosedEnvelope]
- type PossiblyIgnoredApplicationHandler[-E <: Envelope[_]] = ApplicationHandler[PossiblyIgnoredEnvelopeBox, E]
- type PossiblyIgnoredEnvelopeBox[+E <: Envelope[_]] = Traced[Seq[PossiblyIgnoredSequencedEvent[E]]]
Default box for
PossiblyIgnoredProtocolEvents
.Default box for
PossiblyIgnoredProtocolEvents
. The outerTraced
contains a trace context for the entire batch. - type PossiblyIgnoredProtocolEvent = PossiblyIgnoredSequencedEvent[DefaultOpenEnvelope]
Deserialized event with optional payload.
- type PossiblyIgnoredSerializedEvent = PossiblyIgnoredSequencedEvent[ClosedEnvelope]
- type ProcessingSerializedEvent = ProcessingSequencedEvent[ClosedEnvelope]
Default type for serialized events.
Default type for serialized events. Contains trace context and signature.
- type RawProtocolEvent = SequencedEvent[DefaultOpenEnvelope]
Default type for deserialized events.
Default type for deserialized events. The term "raw" indicates that the trace context is missing. Try to use
TracedProtocolEvent
instead. - type RawSignedContentEnvelopeBox[+Env <: Envelope[_]] = SignedContent[SequencedEvent[Env]]
Just a signature around the com.digitalasset.canton.sequencing.protocol.SequencedEvent The term "raw" indicates that the trace context is missing.
Just a signature around the com.digitalasset.canton.sequencing.protocol.SequencedEvent The term "raw" indicates that the trace context is missing. Try to use the box OrdinarySerializedEvent instead.
- sealed trait ResubscriptionStart extends SubscriptionStart
The subscription is a resubscription.
The subscription is a resubscription. The application handler may have previously been called with an event.
- type SequencedApplicationHandler[-E <: Envelope[_]] = ApplicationHandler[SequencedEnvelopeBox, E]
- type SequencedEnvelopeBox[+E <: Envelope[_]] = Traced[Seq[SequencedEventWithTraceContext[E]]]
- type SequencedEventHandler[Err] = (SequencedSerializedEvent) => FutureUnlessShutdown[Either[Err, Unit]]
- class SequencedEventMonotonicityChecker extends NamedLogging
Checks that the sequenced events' stream is gap-free:
Checks that the sequenced events' stream is gap-free:
- We expect event timestamps to be monotonically increasing
- The sequence should start with
previousTimestamp = None
. - For each subsequent event, we expect
previousTimestamp
to be set to the timestamp of the previous event. - When a violation is detected, an error is logged and the processing is aborted.
This is normally ensured by the com.digitalasset.canton.sequencing.client.SequencedEventValidator for individual sequencer subscriptions. However, due to aggregating multiple subscriptions from several sequencers up to a threshold, the stream of events emitted by the aggregation may violate monotonicity. This additional monotonicity check ensures that we catch such violations before we pass the events downstream.
- type SequencedEventOrError = Either[SequencedEventError, SequencedSerializedEvent]
- type SequencedEventOrErrorHandler[Err] = (SequencedEventOrError) => FutureUnlessShutdown[Either[Err, Unit]]
- type SequencedProtocolEvent = SequencedEventWithTraceContext[DefaultOpenEnvelope]
Default type for deserialized events.
Default type for deserialized events. Includes a signature and a trace context.
- type SequencedSerializedEvent = SequencedEventWithTraceContext[ClosedEnvelope]
- class SequencerAggregator extends NamedLogging with FlagCloseable
- class SequencerAggregatorPekko extends NamedLogging
Aggregates sequenced events from a dynamically configurable set of com.digitalasset.canton.sequencing.client.SequencerSubscriptionPekkos until a configurable threshold is reached.
- class SequencerClientRecorder extends FlagCloseable with NamedLogging
Record interactions that the Sequencer client has with its synchronizer.
Record interactions that the Sequencer client has with its synchronizer. If enabled will record sends to the Sequencer and events received from the Sequencer subscription. Callers must call
start
with a path for recording before recording sequencer interactions. - sealed trait SequencerConnection extends PrettyPrinting
Our com.digitalasset.canton.config.ClientConfig provides the static configuration of API connections between console and nodes, and between synchronizer members via the config files.
Our com.digitalasset.canton.config.ClientConfig provides the static configuration of API connections between console and nodes, and between synchronizer members via the config files. Participants however can connect to multiple synchronizers and sequencers, and the configuration of these connections is more dynamic. The structures below are used to represent the dynamic configuration of how a participant connects to a sequencer.
- sealed trait SequencerConnectionValidation extends AnyRef
- trait SequencerConnectionX extends FlagCloseable with NamedLogging
A connection to a sequencer.
A connection to a sequencer. This trait attempts to be independent of the underlying transport.
NOTE: We currently make only a minimal effort to keep transport independence, and there are obvious leaks. This will be extended when we need it.
- trait SequencerConnectionXPool extends FlagCloseable with NamedLogging
Pool of sequencer connections.
Pool of sequencer connections.
The pool is initialized with a configuration describing the individual connections information (endpoint, TLS, etc.) and a trust threshold.
The connections information can combine connections to different logical sequencers (sequencer ID) as well as multiple endpoints for the same logical sequencer, which allows for high-availability for a given sequencer. The contents of the pool then distinguishes between the number of logical sequencers represented nbSequencers and the number of individual connections nbConnections.
The trust threshold has the following functions:
- It represents the number of connections (to different logical sequencers) that must be validated (see com.digitalasset.canton.sequencing.InternalSequencerConnectionX.SequencerConnectionXState.Validated) and agree on bootstrap information (synchronizer ID, static parameters) before the pool is initialized and starts serving connections.
- It is the threshold determining the pool's health. After initialization and during the life of the pool, connections will be removed as they fail and added as they recover. The pool is then considered healthy if the number of connections (to different logical sequencers) is >= the threshold, degraded if it is below, and failing if it reaches 0.
The configuration can also optionally define an expected com.digitalasset.canton.topology.SynchronizerId. If defined, any connection that does not report connecting to that synchronizer will be rejected. If undefined, the synchronizer ID will be determined by consensus once trust-threshold-many connections (to different logical sequencers) report the same synchronizer.
- class SequencerConnectionXPoolImpl extends SequencerConnectionXPool
- trait SequencerConnectionXStub extends AnyRef
A generic stub to interact with a sequencer.
A generic stub to interact with a sequencer. This trait attempts to be independent of the underlying transport.
NOTE: We currently make only a minimal effort to keep transport independence, and there are obvious leaks. This will be extended when we need it.
- trait SequencerConnectionXStubFactory extends AnyRef
- final case class SequencerConnections extends HasVersionedWrapper[SequencerConnections] with PrettyPrinting with Product with Serializable
- trait SequencerSubscriptionPool extends FlagCloseable with NamedLogging
Pool of sequencer subscriptions.
Pool of sequencer subscriptions.
The purpose of this pool is to obtain sequencer connections and start subscriptions on them, trying to maintain a number of live subscriptions sufficient to satisfy the trust requirements.
More precisely, it strives to maintain at least as many subscriptions as the trust threshold. In order to ensure liveness and not run under the trust threshold as soon as a subscription fails, it maintains a few extra subscriptions, defined as the liveness margin. On the other end, it does not maintain as many subscriptions as possible (i.e. all available connections) in order to limit the network traffic.
This pool's health is determined as follows:
- it is healthy if the number of subscriptions is at least the trust threshold + the liveness margin;
- it is degraded if the number of subscriptions is at least the trust threshold, but there are fewer extra subscriptions than the liveness margin;
- it is failing if the number of subscriptions is below the trust threshold.
- final class SequencerSubscriptionPoolImpl extends SequencerSubscriptionPool
- final case class SubmissionRequestAmplification(factor: PositiveInt, patience: NonNegativeFiniteDuration) extends PrettyPrinting with Product with Serializable
Configures the submission request amplification.
Configures the submission request amplification. Amplification makes sequencer clients send eligible submission requests to multiple sequencers to overcome message loss in faulty sequencers.
- factor
The maximum number of times the submission request shall be sent.
- patience
How long the sequencer client should wait after an acknowledged submission to a sequencer to observe the receipt or error before it attempts to send the submission request again (possibly to a different sequencer).
- sealed trait SubscriptionStart extends Product with Serializable with PrettyPrinting
Information passed by the com.digitalasset.canton.sequencing.client.SequencerClient to the ApplicationHandler where the subscription (= processing of events) starts.
Information passed by the com.digitalasset.canton.sequencing.client.SequencerClient to the ApplicationHandler where the subscription (= processing of events) starts. The ApplicationHandler can then initialize itself appropriately.
- type TracedProtocolEvent = WithCounter[Traced[RawProtocolEvent]]
Deserialized event with a trace context.
Deserialized event with a trace context. Use this when you are really sure that a signature will never be needed.
- final case class TrafficControlParameters(maxBaseTrafficAmount: NonNegativeLong = DefaultBaseTrafficAmount, readVsWriteScalingFactor: PositiveInt = DefaultReadVsWriteScalingFactor, maxBaseTrafficAccumulationDuration: PositiveFiniteDuration = DefaultMaxBaseTrafficAccumulationDuration, setBalanceRequestSubmissionWindowSize: PositiveFiniteDuration = DefaultSetBalanceRequestSubmissionWindowSize, enforceRateLimiting: Boolean = DefaultEnforceRateLimiting, baseEventCost: NonNegativeLong = DefaultBaseEventCost) extends PrettyPrinting with Product with Serializable
Traffic control configuration values - stored as dynamic synchronizer parameters
Traffic control configuration values - stored as dynamic synchronizer parameters
- maxBaseTrafficAmount
maximum amount of bytes per maxBaseTrafficAccumulationDuration acquired as "free" traffic per member
- readVsWriteScalingFactor
multiplier used to compute cost of an event. In per ten-mil (1 / 10 000). Defaults to 200 (=2%). A multiplier of 2% means the base cost will be increased by 2% to produce the effective cost.
- maxBaseTrafficAccumulationDuration
maximum amount of time the base rate traffic will accumulate before being capped The minimum granularity is one microsecond. Values below will be rounded up to one microsecond.
- setBalanceRequestSubmissionWindowSize
time window used to compute the max sequencing time set for balance update requests The max sequencing time chosen will be the upper bound of the time window at which the request is submitted
- type UnsignedApplicationHandler[-E <: Envelope[_]] = ApplicationHandler[UnsignedEnvelopeBox, E]
- type UnsignedEnvelopeBox[+E <: Envelope[_]] = Traced[Seq[WithCounter[Traced[SequencedEvent[E]]]]]
A batch of traced protocol events (without a signature) with the assigned counter.
A batch of traced protocol events (without a signature) with the assigned counter. The outer
Traced
contains a trace context for the entire batch. - type UnsignedProtocolEventHandler = ApplicationHandler[UnsignedEnvelopeBox, DefaultOpenEnvelope]
- trait UserSequencerConnectionXStub extends AnyRef
A generic stub for user interactions with a sequencer.
A generic stub for user interactions with a sequencer. This trait attempts to be independent of the underlying transport.
NOTE: We currently make only a minimal effort to keep transport independence, and there are obvious leaks. This will be extended when we need it.
- final case class WithCounter[+WrappedElement](counter: SequencerCounter, element: WrappedElement) extends Product with Serializable
Value Members
- object ApplicationHandler
- object ApplicationHandlerPekko
- object AsyncResult extends Serializable
- object BftSender
Utility class to make BFT-style operations.
- object ConnectionValidationLimiter
- object ConnectionX
- object EnvelopeBox
- object GroupAddressResolver
- object GrpcInternalSequencerConnectionX
- object GrpcSequencerConnection extends Serializable
- object HandlerResult
- object InternalSequencerConnectionX
- object SequencedEventMonotonicityChecker
- object SequencerAggregator
- object SequencerAggregatorPekko
- object SequencerClientRecorder
- object SequencerConnection
- object SequencerConnectionValidation
- object SequencerConnectionXPool
- object SequencerConnectionXPoolFactory
- object SequencerConnectionXPoolImpl
- object SequencerConnectionXStub
- object SequencerConnectionXStubFactoryImpl extends SequencerConnectionXStubFactory
- object SequencerConnections extends HasVersionedMessageCompanion[SequencerConnections] with HasVersionedMessageCompanionDbHelpers[SequencerConnections] with Serializable
- object SequencerSubscriptionPool
- object SequencerSubscriptionPoolFactory
- object SubmissionRequestAmplification extends Serializable
- object SubscriptionStart extends Serializable
- object TrafficControlParameters extends Serializable
- object WithCounter extends Serializable