Packages

package util

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package retry

Type Members

  1. trait BatchAggregator[A, B] extends AnyRef

    This batch aggregator exposes a BatchAggregator.run method that allows for batching scala.concurrent.Future computations, defined by a BatchAggregator.Processor.

    This batch aggregator exposes a BatchAggregator.run method that allows for batching scala.concurrent.Future computations, defined by a BatchAggregator.Processor.

    Note: it is required that getter and batchGetter do not throw an exception. If they do, the number of in-flight requests could fail to be decremented which would result in degraded performance or even prevent calls to the getters.

  2. class BatchAggregatorImpl[A, B] extends BatchAggregator[A, B]
  3. sealed abstract class Checked[+A, +N, +R] extends Product with Serializable

    A monad for aborting and non-aborting errors.

    A monad for aborting and non-aborting errors. Non-aborting errors are accumulated in a cats.data.Chain until the first aborting error is hit. You can think of com.digitalasset.canton.util.Checked as an extension of Either to also support errors that should not cause the computation to abort.

    A

    Type of aborting errors

    N

    Type of non-aborting errors

    R

    Result type of the monad

  4. final case class CheckedT[F[_], A, N, R](value: F[Checked[A, N, R]]) extends Product with Serializable

    Monad Transformer for Checked, allowing the effect of a monad F to be combined with the aborting and non-aborting failure effect of Checked.

    Monad Transformer for Checked, allowing the effect of a monad F to be combined with the aborting and non-aborting failure effect of Checked. Similar to cats.data.EitherT.

  5. trait CheckedTInstances extends AnyRef
  6. trait CheckedTInstances1 extends AnyRef
  7. trait HasFlushFuture extends NamedLogging

    Provides a single flush scala.concurrent.Future that runs asynchronously.

    Provides a single flush scala.concurrent.Future that runs asynchronously. Tasks can be chained onto the flush future, although they will not run sequentially.

  8. trait HasProtoV0[ProtoClass <: GeneratedMessage] extends AnyRef

    Trait for classes that have a corresponding Protobuf definition but **don't** need the ability to be directly serialized into a ByteString or ByteArray.

    Trait for classes that have a corresponding Protobuf definition but **don't** need the ability to be directly serialized into a ByteString or ByteArray. Commonly, this interface should be used when the corresponding Protobuf message is only used in other Protobuf messages or for gRPC calls and responses, but never sent around or stored as a bytestring. E.g. an Envelope is always embedded in a Batch, and therefore doesn't need a serialization method itself because it will be indirectly serialized when the enclosing Batch is serialized.

  9. trait HasProtoV0WithVersion[ProtoClass <: GeneratedMessage] extends AnyRef

    Same as HasProtoV0 but toProtoV0 takes a version argument.This trait generally only be used in rare cases when a Protobuf message contains a nested Versioned... wrapper - see e.g.

    Same as HasProtoV0 but toProtoV0 takes a version argument.This trait generally only be used in rare cases when a Protobuf message contains a nested Versioned... wrapper - see e.g. Batch and Envelope

  10. trait HasVersionedToByteString extends AnyRef

    Trait for classes that can be serialized to a com.google.protobuf.ByteString.

    Trait for classes that can be serialized to a com.google.protobuf.ByteString. Typical use cases of toByteString include:

    • saving data in the database in serialized form (e.g. as in SequencedEvent)
    • encrypting data (e.g. as in Encryption.scala) *

    In some exceptional cases, we also convert an object to a ByteString before including it in a Proto message (e.g. ViewCommonData or Envelope)

    Classes that use Protobuf for serialization should implement HasVersionedWrapper instead. See "CONTRIBUTING.md" for our guidelines on serialization.

  11. trait HasVersionedWrapper[ProtoClass <: GeneratedMessage] extends HasVersionedToByteString

    Trait for classes that can be serialized by using ProtoBuf.

    Trait for classes that can be serialized by using ProtoBuf. See "CONTRIBUTING.md" for our guidelines on serialization.

  12. trait HasVersionedWrapperCompanion[ProtoClass <: GeneratedMessage, ValueClass <: HasVersionedWrapper[ProtoClass]] extends AnyRef

    Trait for the companion objects of classes that implement HasVersionedWrapper.

    Trait for the companion objects of classes that implement HasVersionedWrapper. Provides default methods

  13. class MessageRecorder extends FlagCloseable with NamedLogging

    Persists data for replay tests.

  14. trait NoCopy extends AnyRef

    Prevents auto-generation of the copy method in a case class.

    Prevents auto-generation of the copy method in a case class. Case classes with private constructors typically shouldn't have a copy method.

  15. class NoOpBatchAggregator[A, B] extends BatchAggregator[A, B]
  16. class RateLimiter extends AnyRef

    Utility class that allows clients to keep track of a rate limit.

    Utility class that allows clients to keep track of a rate limit. Clients need to tell an instance whenever they intend to start a new task. The instance will inform the client whether the task can be executed while still meeting the rate limit.

    Guarantees:

    • Maximum burst size: if checkAndUpdateRate is called n times in parallel, at most max(2, maxTasksPerSecond / 5) calls may return true. The upper bound mainly comes from the assumption that System.nanoTime has a resolution of 100.millis.
    • Average rate: if checkAndUpdateRate is called at a rate of at least maxTasksPerSecond during n seconds, then the number of calls that return true divided by n is roughly maxTasksPerSecond when n goes towards infinity. See the unit tests to get a better understanding of the term "roughly".
  17. trait ShowUtil extends ShowSyntax
  18. class SimpleExecutionQueue extends PrettyPrinting

    Functions executed with this class will only run when all previous calls have completed executing.

    Functions executed with this class will only run when all previous calls have completed executing. This can be used when async code should not be run concurrently.

  19. class SingleUseCell[A] extends AnyRef

    This class provides a mutable container for a single value of type A.

    This class provides a mutable container for a single value of type A. The value may be put at most once. A SingleUseCell therefore provides the following immutability guarantee: The value of a cell cannot change; once it has been put there, it will remain in the cell.

  20. class SnapshottableList[A] extends AnyRef

    A mutable list to which elements can be prepended and where snapshots can be taken atomically.

    A mutable list to which elements can be prepended and where snapshots can be taken atomically. Both operations are constant-time. Thread safe.

  21. trait Thereafter[F[_], Content[A]] extends Any

    Typeclass for computations with an operation that can run a side effect after the computation has finished.

    Typeclass for computations with an operation that can run a side effect after the computation has finished.

    The typeclass abstracts the following pattern so that it can be used for types other than scala.concurrent.Future. future.transform { result => val () = body(result); result }

    F

    The computation's type functor.

    Content

    The container type for computation result. Functionally dependent on F.

  22. case class UByte(signed: Byte) extends NoCopy with Product with Serializable

Value Members

  1. object AkkaUtil
  2. object BatchAggregator
  3. object BinaryFileUtil

    Write and read byte strings to files.

  4. object ByteArrayUtil
  5. object ByteStringImplicits
  6. object ByteStringUtil
  7. object ChainUtil

    Provides utility functions for the cats implementation of a Chain.

    Provides utility functions for the cats implementation of a Chain. This is a data-structure similar to a List, with constant time prepend and append. Note that the Chain has a performance hit when pattern matching as there is no constant-time uncons operation.

    Documentation on the cats Chain: https://typelevel.org/cats/datatypes/chain.html.

  8. object Checked extends Serializable
  9. object CheckedT extends CheckedTInstances with Serializable
  10. object DamlPackageLoader

    Wrapper that retrieves parsed packages from a DAR file consumable by the Daml interpreter.

  11. object DelayUtil extends NamedLogging

    Utility to create futures that succeed after a given delay.

    Utility to create futures that succeed after a given delay.

    Inspired by the odelay library, but with a restricted interface to avoid hazardous effects that could be caused by the use of a global executor service.

    TODO(i4245): Replace all usages by Clock.

  12. object EitherTUtil

    Utility functions for the cats cats.data.EitherT monad transformer.

    Utility functions for the cats cats.data.EitherT monad transformer. https://typelevel.org/cats/datatypes/eithert.html

  13. object EitherUtil
  14. object ErrorUtil
  15. object FutureUtil
  16. object HasFlushFuture
  17. object HexString

    Conversion functions to and from hex strings.

  18. object IdUtil

    Contains instances for the Id functor.

  19. object IterableUtil
  20. object LfTransactionUtil

    Helper functions to work with com.digitalasset.daml.lf.transaction.GenTransaction.

    Helper functions to work with com.digitalasset.daml.lf.transaction.GenTransaction. Using these helper functions is useful to provide a buffer from upstream changes.

  21. object LoggerUtil
  22. object MapsUtil
  23. object MessageRecorder
  24. object MonadUtil
  25. object OptionUtil
  26. object PathUtils
  27. object PriorityBlockingQueueUtil
  28. object RangeUtil
  29. object ResourceUtil

    Utility code for doing proper resource management.

    Utility code for doing proper resource management. A lot of it is based on https://medium.com/@dkomanov/scala-try-with-resources-735baad0fd7d

  30. object SetsUtil
  31. object ShowUtil extends ShowUtil

    Utility class for clients who want to make use of pretty printing.

    Utility class for clients who want to make use of pretty printing. Import this as follows:

    import com.digitalasset.canton.util.ShowUtil._
    
    In some cases, an import at the top of the file will not make the show interpolator available. To work around this, you need to import this INSIDE of the using class.

    To enforce pretty printing, the show interpolator should be used for creating strings. That is, show"s$myComplexObject" will result in a compile error, if pretty printing is not implemented for myComplexObject. In contrast, s"$myComplexObject" will fall back to the default (non-pretty) toString implementation, if pretty printing is not implemented for myComplexObject. Even if pretty printing is implemented for the type T of myComplexObject, s"$myComplexObject" will not use it, if the compiler fails to infer T: Pretty.

  32. object SimpleExecutionQueue
  33. object SnapshottableList
  34. object StackTraceUtil
  35. object TextFileUtil
  36. object Thereafter
  37. object TraversableUtil
  38. object TrieMapUtil
  39. object TryUtil
  40. object UByte extends Serializable

Ungrouped