class Crypto extends BaseCrypto with CloseableHealthElement with CompositeHealthElement[String, HealthQuasiComponent] with HealthComponent
Wrapper class to simplify crypto dependency management. It does not validate crypto schemes against the static synchronizer parameters.
- Alphabetic
- By Inheritance
- Crypto
- HealthComponent
- HealthQuasiComponent
- CompositeHealthElement
- CloseableHealthElement
- HealthElement
- FlagCloseable
- PerformUnlessClosing
- HasSynchronizeWithReaders
- HasSynchronizeWithClosing
- OnShutdownRunner
- HasRunOnClosing
- HasUnlessClosing
- AutoCloseable
- BaseCrypto
- NamedLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type State = ComponentHealthState
The type of health states exposed by this component
The type of health states exposed by this component
- Definition Classes
- HealthComponent → HealthQuasiComponent → HealthElement
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 addReader(reader: String)(implicit traceContext: TraceContext): UnlessShutdown[ReaderHandle]
TODO(#16601) Make this method private once PerformUnlessClosing doesn't need it any more
TODO(#16601) Make this method private once PerformUnlessClosing doesn't need it any more
- Attributes
- protected[this]
- Definition Classes
- HasSynchronizeWithReaders
- def alterDependencies(remove: Set[String], add: Map[String, HealthQuasiComponent]): Unit
First removes all dependencies in
remove
, then adds all those inadd
.First removes all dependencies in
remove
, then adds all those inadd
. If anID
appears inremove
andadd
, then theID
is replaced. Refreshes the state if any of the dependencies was changed.Updates of
dependencies
are not atomic: If this method is called concurrently multiple times, the resulting dependencies may not correspond to a serializable execution.If an dependency triggers a concurrent state refresh, then the state refresh may see an inconsistent set of dependencies and therefore derive an inconsistent state. This however is only temporary as in this case another state refresh will be triggered at the end.
- Attributes
- protected
- Definition Classes
- CompositeHealthElement
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def associatedHasRunOnClosing: FlagCloseable
The com.digitalasset.canton.lifecycle.HasRunOnClosing associated with this object.
The com.digitalasset.canton.lifecycle.HasRunOnClosing associated with this object.
When this com.digitalasset.canton.lifecycle.HasRunOnClosing closes, the health state permanently becomes closingState and all listeners are notified about this.
- Attributes
- protected
- Definition Classes
- CloseableHealthElement → HealthElement
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- 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
- def closingState: ComponentHealthState
The state set when the associatedHasRunOnClosing closes
The state set when the associatedHasRunOnClosing closes
- Definition Classes
- HealthComponent → HealthQuasiComponent → HealthElement
- def closingTimeout: FiniteDuration
- Attributes
- protected
- Definition Classes
- FlagCloseable → PerformUnlessClosing
- def combineDependentStates: ComponentHealthState
Fetch the current states from the relevant dependencies and combine them into the new state to report for this element.
Fetch the current states from the relevant dependencies and combine them into the new state to report for this element.
- Attributes
- protected
- Definition Classes
- Crypto → CompositeHealthElement
- val cryptoPrivateStore: CryptoPrivateStore
- Definition Classes
- Crypto → BaseCrypto
- val cryptoPublicStore: CryptoPublicStore
- Definition Classes
- Crypto → BaseCrypto
- implicit val ec: ExecutionContext
- Definition Classes
- Crypto → BaseCrypto
- 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 generateEncryptionKey(keySpec: EncryptionKeySpec = privateCrypto.encryptionKeySpecs.default, name: Option[KeyName] = None)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, EncryptionKeyGenerationError, EncryptionPublicKey]
Helper method to generate a new encryption key pair and store the public key in the public store as well.
Helper method to generate a new encryption key pair and store the public key in the public store as well.
- Definition Classes
- BaseCrypto
- def generateSigningKey(keySpec: SigningKeySpec = privateCrypto.signingKeySpecs.default, usage: NonEmpty[Set[SigningKeyUsage]], name: Option[KeyName] = None)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, SigningKeyGenerationError, SigningPublicKey]
Helper method to generate a new signing key pair and store the public key in the public store as well.
Helper method to generate a new signing key pair and store the public key in the public store as well.
- Definition Classes
- BaseCrypto
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getDependencies: Map[String, HealthQuasiComponent]
- Attributes
- protected
- Definition Classes
- CompositeHealthElement
- final def getState: State
Returns the current state
Returns the current state
- Definition Classes
- HealthElement
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initialHealthState: ComponentHealthState
The initial state upon creation
The initial state upon creation
- Attributes
- protected
- Definition Classes
- Crypto → HealthElement
- 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 → HasUnlessClosing
- def isDegraded: Boolean
- Definition Classes
- HealthQuasiComponent
- def isFailed: Boolean
- Definition Classes
- HealthQuasiComponent
- def isFatal: Boolean
- Definition Classes
- HealthQuasiComponent
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isOk: Boolean
- Definition Classes
- HealthQuasiComponent
- def keepTrackOfReaderCallStack: Boolean
Set this to true to get detailed information about all futures that did not complete during shutdown.
Set this to true to get detailed information about all futures that did not complete during shutdown.
- Attributes
- protected[this]
- Definition Classes
- PerformUnlessClosing → HasSynchronizeWithReaders
- def logger: TracedLogger
- Attributes
- protected
- Definition Classes
- NamedLogging
- val loggerFactory: NamedLoggerFactory
- Definition Classes
- Crypto → NamedLogging
- def name: String
Name of the health element.
Name of the health element. Used for logging.
- Definition Classes
- Crypto → HealthElement
- def nameInternal: String
- Attributes
- protected[this]
- Definition Classes
- PerformUnlessClosing → HasSynchronizeWithReaders
- 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 onCloseFailure(e: Throwable): Unit
- Attributes
- protected
- Definition Classes
- PerformUnlessClosing
- def onClosed(): Unit
- Definition Classes
- Crypto → 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
- def prettyState: Pretty[State]
- Attributes
- protected
- Definition Classes
- HealthQuasiComponent → HealthElement
- val privateCrypto: CryptoPrivateApi
- Definition Classes
- Crypto → BaseCrypto
- val pureCrypto: CryptoPureApi
- Definition Classes
- Crypto → BaseCrypto
- def refreshFromDependencies()(implicit traceContext: TraceContext): Unit
- Attributes
- protected
- Definition Classes
- CompositeHealthElement
- def refreshState(newState: Eval[State])(implicit traceContext: TraceContext): Unit
Triggers a refresh of the component's state, using
newState
to determine the new state.Triggers a refresh of the component's state, using
newState
to determine the new state. May return before thenewState
has been evaluated and the listeners have been poked.Note that listeners need not be poked about every state change; it suffices that they are poked eventually after each state change. So if there are frequent updates to the state, possibly from concurrent calls, then the listeners may never see some intermediate states.
- Attributes
- protected
- Definition Classes
- HealthElement
- def registerHighPriorityOnHealthChange(listener: HealthListener): Boolean
Registers a high priority listener that gets poked upon each change of this element's health state.
Registers a high priority listener that gets poked upon each change of this element's health state. This listener will be run before listeners registered via registerOnHealthChange
- returns
Whether the listener was not registered before
- Definition Classes
- HealthElement
- def registerOnHealthChange(listener: HealthListener, pokeIfNew: Boolean = true): Boolean
Registers a listener that gets poked upon each change of this element's health state.
Registers a listener that gets poked upon each change of this element's health state.
- pokeIfNew
if true (default), poke the listener if it's new
- returns
Whether the listener was not registered before
- Definition Classes
- HealthElement
- def remainingReaders(): Seq[String]
- Attributes
- protected[this]
- Definition Classes
- HasSynchronizeWithReaders
- def removeDependency(id: String): Unit
- Attributes
- protected
- Definition Classes
- CompositeHealthElement
- def removeReader(handle: ReaderHandle): Unit
TODO(#16601) Make this method private once PerformUnlessClosing doesn't need it any more
TODO(#16601) Make this method private once PerformUnlessClosing doesn't need it any more
- Attributes
- protected[this]
- Definition Classes
- HasSynchronizeWithReaders
- def runOnClose(task: RunOnClosing): UnlessShutdown[LifeCycleRegistrationHandle]
Schedules the given task to be run upon closing.
Schedules the given task to be run upon closing.
- returns
An com.digitalasset.canton.lifecycle.UnlessShutdown.Outcome indicates that the task will have been run when the
LifeCycleManager
'scloseAsync
method completes or whenAutoCloseable
'sclose
method returns, unless the returnedLifeCycleRegistrationHandle
was used to cancel the task or the task has been done beforehand. com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if the task is not run due to closing. This always happens if isClosing returns true.
- Definition Classes
- OnShutdownRunner → HasRunOnClosing
- def runOnOrAfterClose(task: RunOnClosing)(implicit traceContext: TraceContext): LifeCycleRegistrationHandle
Register a task to run when closing is initiated, or run it immediately if closing is already ongoing.
Register a task to run when closing is initiated, or run it immediately if closing is already ongoing. Unlike runOnClose, this method does not guarantee that this task will have run by the time the
LifeCycleManager
'scloseAsync
method completes orAutoCloseable
'sclose
returns. This is because the task is run immediately if the component has already been closed.- Definition Classes
- HasRunOnClosing
- final def runOnOrAfterClose_(task: RunOnClosing)(implicit traceContext: TraceContext): Unit
Variant of runOnOrAfterClose that does not return a com.digitalasset.canton.lifecycle.LifeCycleRegistrationHandle.
Variant of runOnOrAfterClose that does not return a com.digitalasset.canton.lifecycle.LifeCycleRegistrationHandle.
- Definition Classes
- HasRunOnClosing
- def runTaskUnlessDone(task: RunOnClosing)(implicit traceContext: TraceContext): Unit
- Attributes
- protected[this]
- Definition Classes
- OnShutdownRunner → HasRunOnClosing
- def setDependency(id: String, dependency: HealthQuasiComponent): Unit
- Attributes
- protected
- Definition Classes
- CompositeHealthElement
- def stateLoggingLevel(state: ComponentHealthState): Level
- Attributes
- protected
- Definition Classes
- HealthComponent → HealthElement
- def synchronizeWithClosing[F[_], A](name: String)(f: => F[A])(implicit traceContext: TraceContext, F: Thereafter[F], A: CanAbortDueToShutdown[F]): F[A]
Runs the computation
f
only if the component is not yet closing.Runs the computation
f
only if the component is not yet closing. If so, the component will delay releasing its resources untilf
has completed (as defined by the com.digitalasset.canton.util.Thereafter instance) or thesynchronizeWithClosingPatience
has elapsed.DO NOT CALL
this.close
as part off
, because it will result in a deadlock. DO NOT PUT retries, especially indefinite ones, insidef
.- returns
The computation completes with com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if
f
has not run. Otherwise it is the result of runningf
.
- Definition Classes
- HasSynchronizeWithClosing
- See also
HasRunOnClosing.isClosing
- def synchronizeWithClosingF[A](name: String)(f: => Future[A])(implicit ec: ExecutionContext, traceContext: TraceContext): FutureUnlessShutdown[A]
Convenience method for synchronizing on
Future
s instead ofFutureUnlessShutdown
s.Convenience method for synchronizing on
Future
s instead ofFutureUnlessShutdown
s. Equivalent tosynchronizeWithClosing(name)(FutureUnlessShutdown.outcomeF(f))
- Definition Classes
- PerformUnlessClosing
- def synchronizeWithClosingPatience: FiniteDuration
- Attributes
- protected[this]
- Definition Classes
- PerformUnlessClosing → HasSynchronizeWithReaders
- def synchronizeWithClosingSync[A](name: String)(f: => A)(implicit traceContext: TraceContext): UnlessShutdown[A]
Runs the computation
f
only if the component is not yet closing.Runs the computation
f
only if the component is not yet closing. If so, the component will delay releasing its resources untilf
has finished or thesynchronizeWithClosingPatience
has elapsed.DO NOT CALL
this.close
as part off
, because it will result in a deadlock. DO NOT PUT retries, especially indefinite ones, insidef
.- returns
com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if
f
has not run.
- Definition Classes
- HasSynchronizeWithClosing
- Annotations
- @SuppressWarnings()
- See also
HasRunOnClosing.isClosing
- def synchronizeWithClosingUS[F[_], A](name: String)(f: => F[A])(implicit traceContext: TraceContext, F: Thereafter[F]): UnlessShutdown[F[A]]
Runs the computation
f
only if the component is not yet closing.Runs the computation
f
only if the component is not yet closing. If so, the component will delay releasing its resources untilf
has completed (as defined by the com.digitalasset.canton.util.Thereafter instance) or thesynchronizeWithClosingPatience
has elapsed.DO NOT CALL
this.close
as part off
, because it will result in a deadlock. DO NOT PUT retries, especially indefinite ones, insidef
.- returns
com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if
f
has not run. Otherwise the result of runningf
.
- Definition Classes
- PerformUnlessClosing → HasSynchronizeWithClosing
- See also
HasRunOnClosing.isClosing
- def synchronizeWithReaders()(implicit traceContext: TraceContext): Boolean
- Attributes
- protected[this]
- Definition Classes
- HasSynchronizeWithReaders
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val timeouts: ProcessingTimeout
- Definition Classes
- Crypto → FlagCloseable
- def toComponentStatus: ComponentStatus
- Definition Classes
- HealthQuasiComponent
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def unlessClosing[F[_], A](fa: => F[A])(implicit F: CanAbortDueToShutdown[F]): F[A]
Runs the computation
fa
unless isClosing returns true.Runs the computation
fa
unless isClosing returns true.This method does not delay the closing while
fa
is running, unlike the methods inHasSynchronizeWithClosing
. Accordingly, this method is useful for intermittent checks whether the result of the computation is still relevant.- returns
The result of
fa
or com.digitalasset.canton.lifecycle.UnlessShutdown.AbortedDueToShutdown if isClosing is true
- Definition Classes
- HasUnlessClosing
- Annotations
- @inline()
- def unregisterOnHealthChange(listener: HealthListener): Boolean
Unregisters a listener.
Unregisters a listener.
- returns
Whether the listener was registered before.
- Definition Classes
- HealthElement
- 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])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withReader[F[_], A](name: String)(f: => F[A])(implicit traceContext: TraceContext, F: Thereafter[F]): UnlessShutdown[F[A]]
- Attributes
- protected[this]
- Definition Classes
- HasSynchronizeWithReaders