class InMemorySequencerStore extends SequencerStore
- Alphabetic
- By Inheritance
- InMemorySequencerStore
- SequencerStore
- AutoCloseable
- NamedLogging
- SequencerMemberValidator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new InMemorySequencerStore(protocolVersion: ProtocolVersion, sequencerMember: Member, blockSequencerMode: Boolean, loggerFactory: NamedLoggerFactory, sequencerMetrics: SequencerMetrics)(implicit executionContext: ExecutionContext)
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 acknowledge(member: SequencerMemberId, timestamp: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
Write an acknowledgement that member has processed earlier timestamps.
Write an acknowledgement that member has processed earlier timestamps. Only the latest timestamp needs to be stored. Earlier timestamps can be overwritten. Acknowledgements of earlier timestamps should be ignored.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val batchingConfig: BatchingConfig
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- val blockSequencerMode: Boolean
Whether the sequencer store operates is used for a block sequencer or a standalone database sequencer.
Whether the sequencer store operates is used for a block sequencer or a standalone database sequencer.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- final def bufferEvents(events: NonEmpty[Seq[Sequenced[BytesPayload]]]): Unit
In case of single instance sequencer we can use in-memory fanout buffer for events
In case of single instance sequencer we can use in-memory fanout buffer for events
- Definition Classes
- SequencerStore
- def bufferedEventsMaxMemory: BytesUnit
Maximum memory usage by the events in the buffer before it starts dropping events.
Maximum memory usage by the events in the buffer before it starts dropping events. If set to 0, caching is disabled and all requests go to the underlying store (e.g. database).
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def close(): Unit
- Definition Classes
- InMemorySequencerStore → AutoCloseable
- def countRecords(implicit traceContext: TraceContext): FutureUnlessShutdown[SequencerStoreRecordCounts]
Count records currently stored by the sequencer.
Count records currently stored by the sequencer. Used for pruning tests.
- Attributes
- protected[canton]
- Definition Classes
- InMemorySequencerStore → SequencerStore
- Annotations
- @VisibleForTesting()
- def deleteEventsPastWatermark(instanceIndex: Int)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
No implementation as only required for crash recovery
No implementation as only required for crash recovery
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def disableMember(member: Member)(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
Prevents member from sending and reading from the sequencer, and allows unread data for this member to be pruned.
Prevents member from sending and reading from the sequencer, and allows unread data for this member to be pruned. It however won't stop any sends addressed to this member.
- Definition Classes
- SequencerStore
- def disableMemberInternal(memberId: SequencerMemberId)(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- 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
- val eventsBuffer: EventsBuffer
- Attributes
- protected
- Definition Classes
- SequencerStore
- lazy val eventsBufferEnabled: Boolean
- Definition Classes
- SequencerStore
- Annotations
- @VisibleForTesting()
- implicit val executionContext: ExecutionContext
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def fetchLowerBound()(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[(CantonTimestamp, Option[CantonTimestamp])]]
Fetch the lower bound of events that can be read.
Fetch the lower bound of events that can be read. Returns
None
if all events can be read.- Definition Classes
- InMemorySequencerStore → SequencerStore
- def fetchOnlineInstances(implicit traceContext: TraceContext): FutureUnlessShutdown[SortedSet[Int]]
There can be no other sequencers sharing this storage
There can be no other sequencers sharing this storage
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def fetchPreviousEventTimestamp(memberId: SequencerMemberId, timestampInclusive: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
Fetch previous event timestamp for a member for a given inclusive timestamp.
Fetch previous event timestamp for a member for a given inclusive timestamp.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def fetchWatermark(instanceIndex: Int, maxRetries: Int = retry.Forever)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[Watermark]]
Read the watermark for this sequencer and its online/offline status.
Read the watermark for this sequencer and its online/offline status. Currently only used for testing.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def goOffline(instanceIndex: Int)(implicit traceContext: TraceContext, callerCloseContext: CloseContext): FutureUnlessShutdown[Unit]
Flag that we're going offline (likely due to a shutdown)
Flag that we're going offline (likely due to a shutdown)
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def goOnline(instanceIndex: Int, now: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[CantonTimestamp]
Mark the sequencer as online and return a timestamp for when this sequencer can start safely producing events.
Mark the sequencer as online and return a timestamp for when this sequencer can start safely producing events.
- now
Now according to this sequencer's clock which will be used if it is ahead of the lowest available timestamp from other sequencers.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeFromSnapshot(initialState: SequencerInitialState)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, String, Unit]
- Definition Classes
- SequencerStore
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isMemberRegisteredAt(member: Member, time: CantonTimestamp)(implicit tc: TraceContext): FutureUnlessShutdown[Boolean]
- Definition Classes
- SequencerStore → SequencerMemberValidator
- def latestAcknowledgements()(implicit traceContext: TraceContext): FutureUnlessShutdown[Map[SequencerMemberId, CantonTimestamp]]
Return the latest acknowledgements for all members
Return the latest acknowledgements for all members
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def latestTopologyClientRecipientTimestamp(member: Member, timestampExclusive: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
For a given member and timestamp, return the latest timestamp of a potential topology change, that reached both the sequencer and the member.
For a given member and timestamp, return the latest timestamp of a potential topology change, that reached both the sequencer and the member. To be used by the topology snapshot awaiting, should there be a topology change expected to need to be taken into account for
timestampExclusive
sequencing timestamp.- Definition Classes
- InMemorySequencerStore → SequencerStore
- def locatePruningTimestamp(skip: NonNegativeInt)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
Locate a timestamp relative to the earliest available event based on a skip index starting at 0.
Locate a timestamp relative to the earliest available event based on a skip index starting at 0. Useful to monitor the progress of pruning and for pruning in batches.
- returns
The timestamp of the (skip+1)'th event if it exists, None otherwise.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → NamedLogging
- final def lookupMember(member: Member)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[RegisteredMember]]
Lookup an existing member id for the given member.
Lookup an existing member id for the given member. Will return a cached value if available. Return scala.None if no id exists.
- Definition Classes
- SequencerStore
- def lookupMemberInternal(member: Member)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[RegisteredMember]]
Lookup member directly without caching.
Lookup member directly without caching.
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def markLaggingSequencersOffline(cutoffTime: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
This store does not support multiple concurrent instances so will do nothing.
This store does not support multiple concurrent instances so will do nothing.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- 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
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def preloadBufferInternal()(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def previousEventTimestamp(memberId: SequencerMemberId, timestampExclusive: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
For a given member find the timestamp of the last event that the member has received before
timestampExclusive
.For a given member find the timestamp of the last event that the member has received before
timestampExclusive
.- Definition Classes
- InMemorySequencerStore → SequencerStore
- def prune(requestedTimestamp: CantonTimestamp, status: SequencerPruningStatus, payloadToEventMargin: NonNegativeFiniteDuration)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, PruningError, SequencerPruningResult]
Prune as much data as safely possible from before the given timestamp.
Prune as much data as safely possible from before the given timestamp.
- requestedTimestamp
the timestamp that we would like to prune up to (see docs on using the pruning status and disabling members for picking this value)
- status
the pruning status that should be used for determining a safe to prune time for validation
- payloadToEventMargin
the maximum time margin between payloads and events. once we have a safe to prune timestamp we simply prune all payloads at
safeTimestamp - margin
to ensure no payloads are removed where events will remain. typically sourced from SequencerWriterConfig.payloadToEventMargin.- returns
the timestamp up to which the database sequencer has been pruned (lower than requestedTimestamp) and a human readable report on what has been removed.
- Definition Classes
- SequencerStore
- def pruneEvents(beforeExclusive: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Int]
Prune events before the given timestamp
Prune events before the given timestamp
- returns
a best efforts count of how many events were removed. this value can be less than the number of events actually removed if technical issues prevent a full count from being returned (e.g. with a database we may retry a delete after a connectivity issue and find that all events were successfully removed and have 0 rows removed returned).
- Attributes
- protected[store]
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def prunePayloads(beforeExclusive: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[Int]
Prune payloads before the given timestamp
Prune payloads before the given timestamp
- returns
a best efforts count of how many events were removed. this value can be less than the number of payloads actually removed if technical issues prevent a full count from being returned.
- Attributes
- protected[store]
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def readEvents(memberId: SequencerMemberId, member: Member, fromExclusiveO: Option[CantonTimestamp], limit: Int)(implicit traceContext: TraceContext, metricsContext: MetricsContext): FutureUnlessShutdown[ReadEvents]
Read all events of which a member is a recipient from the provided timestamp but no greater than the earliest watermark.
Read all events of which a member is a recipient from the provided timestamp but no greater than the earliest watermark. Passing both
member
andmemberId
to avoid a database query for the lookup.- Definition Classes
- SequencerStore
- def readEventsInternal(memberId: SequencerMemberId, fromExclusiveO: Option[CantonTimestamp] = None, limit: Int = 100)(implicit traceContext: TraceContext): FutureUnlessShutdown[ReadEvents]
Internal non-buffered implementation of
readEvents
.Internal non-buffered implementation of
readEvents
.- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def readPayloads(payloadIds: Seq[IdOrPayload], member: Member)(implicit traceContext: TraceContext): FutureUnlessShutdown[Map[PayloadId, Batch[ClosedEnvelope]]]
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def readStateAtTimestamp(timestamp: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[SequencerSnapshot]
The state returned here is used to initialize a separate database sequencer (that does not share the same database as this one) using initializeFromSnapshot such that this new sequencer has enough information (registered members, previous event timestamps, etc) to be able to process new events from the same point as this sequencer to the same clients.
The state returned here is used to initialize a separate database sequencer (that does not share the same database as this one) using initializeFromSnapshot such that this new sequencer has enough information (registered members, previous event timestamps, etc) to be able to process new events from the same point as this sequencer to the same clients. This is typically used by block sequencers that use the database sequencer as local storage such that they will process the same events in the same order and they need to be able to spin up new block sequencers from a specific point in time.
- returns
state at the given time
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def registerMember(member: Member, timestamp: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[SequencerMemberId]
Register the provided member.
Register the provided member. Should be idempotent if member is already registered and return the existing id.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- final def resetAndPreloadBuffer()(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
- Definition Classes
- SequencerStore
- def resetWatermark(instanceIndex: Int, ts: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, SaveWatermarkError, Unit]
Reset the watermark to an earlier value, i.e.
Reset the watermark to an earlier value, i.e. in case of working as a part of block sequencer. Also sets the sequencer as offline. If current watermark value is before
ts
, it will be left unchanged. If a watermark doesn't yet exist, it won't be inserted, because it would effectively mean setting it to a future value.- Definition Classes
- InMemorySequencerStore → SequencerStore
- def safeWatermark(implicit traceContext: TraceContext): FutureUnlessShutdown[Option[CantonTimestamp]]
Return the minimum watermark across all online sequencers
Return the minimum watermark across all online sequencers
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def saveEvents(instanceIndex: Int, eventsToInsert: NonEmpty[Seq[Sequenced[PayloadId]]])(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
Save a series of events to the store.
Save a series of events to the store. Callers should determine batch size. No batching is done within the store. Callers MUST ensure that event-ids are unique as no errors will be returned if a duplicate is present (for the sequencer writer see sequencer.PartitionedTimestampGenerator for use with their instance index).
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def saveLowerBound(ts: CantonTimestamp, latestTopologyClientTimestamp: Option[CantonTimestamp])(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, SaveLowerBoundError, Unit]
Save an updated lower bound of events that can be read.
Save an updated lower bound of events that can be read. Must be equal or greater than any prior set lower bound.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- Exceptions thrown
java.lang.IllegalArgumentException
if timestamp is lower than existing lower bound
- def savePayloads(payloadsToInsert: NonEmpty[Seq[BytesPayload]], instanceDiscriminator: UUID)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, SavePayloadsError, Unit]
Save a series of payloads to the store.
Save a series of payloads to the store. Is up to the caller to determine a reasonable batch size and no batching is done within the store.
- instanceDiscriminator
a unique ephemeral value to ensure that no other sequencer instances are writing conflicting payloads without having to check the payload body
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def saveWatermark(instanceIndex: Int, ts: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, SaveWatermarkError, Unit]
Write the watermark that we promise not to write anything earlier than.
Write the watermark that we promise not to write anything earlier than. Does not indicate that there is an event written by this sequencer for this timestamp as there may be no activity at the sequencer, but updating the timestamp allows the sequencer to indicate that it's still alive. Return an error if we find our sequencer is offline.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- val sequencerMember: Member
- Definition Classes
- InMemorySequencerStore → SequencerStore
- val sequencerMetrics: SequencerMetrics
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def status(now: CantonTimestamp)(implicit traceContext: TraceContext): FutureUnlessShutdown[SequencerPruningStatus]
Build a status object representing the current state of the sequencer.
Build a status object representing the current state of the sequencer.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def updatePrunedPreviousEventTimestamps(updatedPreviousTimestamps: Map[Member, Option[CantonTimestamp]])(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
Set the "pruned" previous event timestamp for a member.
Set the "pruned" previous event timestamp for a member. This timestamp is used to serve the oldest (earliest) event that sequencer has for the member:
- after pruning
- after the sequencer's onboarding
- Definition Classes
- SequencerStore
- def updatePrunedPreviousEventTimestampsInternal(updatedPreviousTimestamps: Map[SequencerMemberId, CantonTimestamp])(implicit traceContext: TraceContext): FutureUnlessShutdown[Unit]
- Attributes
- protected
- Definition Classes
- InMemorySequencerStore → SequencerStore
- def validateCommitMode(configuredCommitMode: CommitMode)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, String, Unit]
Validate that the commit mode of a session is inline with the configured expected commit mode.
Validate that the commit mode of a session is inline with the configured expected commit mode. Return a human readable message about the mismatch in commit modes if not.
- Definition Classes
- InMemorySequencerStore → SequencerStore
- 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])