com.digitalasset.canton.participant.protocol.conflictdetection
LockableStates
Companion object LockableStates
class LockableStates[Key, Status <: PrettyPrinting with HasPrunable, E] extends NamedLogging
Manages in-memory states of items (contracts, keys, ...) that are used or modified by in-flight requests. Such in-memory states take precedence over the states in the underlying store, which is only updated when a request is finalized.
- Key
Identifier for states
- Status
The status type for states.
- Alphabetic
- By Inheritance
- LockableStates
- NamedLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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 checkAndLock(handle: LockableStatesCheckHandle[Key, Status])(implicit traceContext: TraceContext): (Seq[Key], ActivenessCheckResult[Key, Status])
Performs the activeness check consisting of the following:
Performs the activeness check consisting of the following:
- Check that LockableStates$.LockableStatesCheckHandle
.fresh
are fresh. - Check that LockableStates$.LockableStatesCheckHandle
.free
are free, i.e., if they are in known, then they are not locked and free as determined by LockableStatus.isFree - Check that LockableStates$.LockableStatesCheckHandle
.active
are active, i.e., they are known and not locked and active as determined by LockableStatus.isActive. - Lock all in LockableStates$.LockableStatesCheckHandle
.lockOnly
and the above that are marked for locking.
Must not be called concurrently with other methods of this class unless stated otherwise.
- returns
The activeness result of the activeness check
- Exceptions thrown
IllegalConflictDetectionStateException
if the handle has outstanding pre-fetches.
- Check that LockableStates$.LockableStatesCheckHandle
- implicit val classTagKey: ClassTag[Key]
- 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
- implicit def errorLoggingContext(implicit traceContext: TraceContext): ErrorLoggingContext
- Attributes
- protected
- Definition Classes
- NamedLogging
- def getApproximateStates(ids: Seq[Key])(implicit traceContext: TraceContext): Future[Map[Key, StateChange[Status]]]
Returns the state of
id
, fetching it from the store if it is not in memory.Returns the state of
id
, fetching it from the store if it is not in memory. May be called concurrently with any other method. In that case, the returned state may be outdated. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def invariant[A, B, C](pendingActivenessChecks: Map[RequestCounter, A], locked: Map[RequestCounter, B], pendingEvictions: Map[RequestCounter, C])(selectorActiveness: (A) => Set[Key], selectorLocked: (B) => Seq[Key], selectorPending: (C) => Seq[Key])(implicit traceContext: TraceContext): Unit
Checks the class invariant.
Checks the class invariant.
Must not be called concurrently with other methods of this class unless stated otherwise.
- Exceptions thrown
IllegalConflictDetectionStateException
if the invariant does not hold.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- implicit val lockableStatus: LockableStatus[Status]
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Attributes
- protected
- Definition Classes
- LockableStates → NamedLogging
- 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 pendingActivenessCheck(rc: RequestCounter, check: ActivenessCheck[Key])(implicit traceContext: TraceContext): LockableStatesCheckHandle[Key, Status]
Registers the activeness check as pending for the given request.
Registers the activeness check as pending for the given request.
Must not be called concurrently with other methods of this class unless stated otherwise.
- def prefetchStates(toBeFetched: Iterable[Key])(implicit traceContext: TraceContext): Future[Map[Key, StateChange[Status]]]
Fetches the given states from the store and returns them.
Fetches the given states from the store and returns them. Nonexistent items are excluded from the returned map.
May be called concurrently with other methods of this class.
- implicit val prettyKey: Pretty[Key]
- def providePrefetchedStates(handle: LockableStatesCheckHandle[Key, Status], fetched: Map[Key, StateChange[Status]])(implicit traceContext: TraceContext): Unit
Adds the
fetched
states to the in-memory states that are cached in the handle.Adds the
fetched
states to the in-memory states that are cached in the handle. Items inhandle
's LockableStates.LockableStatesCheckHandle.toBeFetched are considered treated as nonexistent iffetched
does not contain them.Must not be called concurrently with other methods of this class unless stated otherwise.
- def releaseLock(rc: RequestCounter, id: Key)(implicit traceContext: TraceContext): Unit
Must not be called concurrently with other methods of this class unless stated otherwise.
- def setStatusPendingWrite(id: Key, newState: Status, toc: TimeOfChange): Unit
Must not be called concurrently with other methods of this class unless stated otherwise.
- def signalWriteAndTryEvict(rc: RequestCounter, id: Key)(implicit traceContext: TraceContext): Unit
Evict the state if it is no longer needed in the map.
Evict the state if it is no longer needed in the map.
Must not be called concurrently with other methods of this class unless stated otherwise.
- 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])