Packages

trait ActiveContractStore extends ActiveContractSnapshot with ConflictDetectionStore[LfContractId, Status, AcsError]

The active contract store (ACS) stores for every contract ID whether it is inexistent, ActiveContractStore.Active, ActiveContractStore.Archived, or ActiveContractStore.TransferredAway, along with the timestamp of the latest change. Every change is associated with the timestamp and request counter of the request that triggered the change. The changes are ordered first by timestamp, then by request counter, and finally by change type (activations before deactivations). Implementations must be thread-safe. Updates must be idempotent.

Creations, transfers, and archivals can be mixed arbitrarily. A contract may be transferred in and out several times during its lifetime. It becomes active with every transfer-in and transferred away with every transfer-out. If the ACS detects irregularities, the change method reports them.

These methods are supposed to be called by the com.digitalasset.canton.participant.protocol.conflictdetection.ConflictDetector only, which coordinates the request journal updates and the updates to the ACS.

Updates may be written asynchronously. Every implementation determines an order over all the changes and queries to the ACS. Each individual change must be applied atomically and the result is determined with respect to this order. This order need not be consistent with the order of the calls, though. However, the following is guaranteed: If the future returned by a call completes and observing the completion happens before another call, then all changes of the former call must be ordered before all changes of the later call.

Bulk methods like ActiveContractStore.createContracts and ActiveContractStore.archiveContracts generate one individual change for each contract. So their changes may be interleaved with other calls.

See also

ActiveContractSnapshot for the ACS snapshot interface

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActiveContractStore
  2. ConflictDetectionStore
  3. PrunableByTime
  4. ActiveContractSnapshot
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def advancePruningTimestamp(phase: PruningPhase, timestamp: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[Future, AcsError, Unit]
    Attributes
    protected[canton]
    Definition Classes
    PrunableByTime
    Annotations
    @VisibleForTesting()
  2. abstract def archiveContracts(contractIds: Seq[LfContractId], toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Marks the given contracts as archived from toc's timestamp (inclusive) onwards.

    Marks the given contracts as archived from toc's timestamp (inclusive) onwards.

    contractIds

    The contract IDs of the contracts to be archived

    toc

    The time of change consisting of

    • The request counter of the confirmation request that archives the contracts.
    • The timestamp on the confirmation request that archives the contracts.
    returns

    The future completes when all contract states have been updated. The following irregularities are reported for each contract:

  3. abstract def changesBetween(fromExclusive: TimeOfChange, toInclusive: TimeOfChange)(implicit traceContext: TraceContext): Future[LazyList[(TimeOfChange, ActiveContractIdsChange)]]

    Returns all changes to the active contract set between the two timestamps (both inclusive) in the order of their changes.

    Returns all changes to the active contract set between the two timestamps (both inclusive) in the order of their changes. The provided lower bound must not be larger than the upper bound.

    fromExclusive

    The lower bound for the changes. Must not be larger than the upper bound.

    toInclusive

    The upper bound for the changes. Must not be smaller than the lower bound.

    Definition Classes
    ActiveContractSnapshot
    Exceptions thrown

    java.lang.IllegalArgumentException If the intervals are in the wrong order.

  4. abstract def contractSnapshot(contractIds: Set[LfContractId], timestamp: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[Future, AcsError, Map[LfContractId, CantonTimestamp]]

    Returns a map to the timestamp when the contract became active for the last time before or at the given timestamp.

    Returns a map to the timestamp when the contract became active for the last time before or at the given timestamp. Omits contracts that not active right after the given timestamp.

    timestamp

    The timestamp at which the activeness of the contracts shall be determined. Must be before the timestamp that corresponds to the head cursor in the com.digitalasset.canton.participant.protocol.RequestJournal for the state com.digitalasset.canton.participant.protocol.RequestJournal.RequestState.Clean. If this precondition is violated, the returned snapshot may be inconsistent, i.e., it may omit some contracts that were ActiveContractStore.Active at the given time and it may include contracts that were actually ActiveContractStore.Archived or ActiveContractStore.TransferredAway.

    Definition Classes
    ActiveContractSnapshot
  5. abstract def createContracts(contractIds: Seq[LfContractId], toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Marks the given contracts as active from timestamp (inclusive) onwards.

    Marks the given contracts as active from timestamp (inclusive) onwards.

    contractIds

    The contract IDs of the created contracts

    toc

    The time of change consisting of

    • The request counter of the confirmation request that created the contracts
    • The timestamp of the confirmation request that created the contracts.
    returns

    The future completes when all contract states have been updated. The following irregularities are reported for each contract:

  6. abstract def deleteSince(criterion: RequestCounter)(implicit traceContext: TraceContext): Future[Unit]

    Deletes all activeness changes from requests whose request counter is at least the given one.

    Deletes all activeness changes from requests whose request counter is at least the given one. This method must not be called concurrently with creating, archiving, or transferring contracts.

    Therefore, this method need not be linearizable w.r.t. creating, archiving, or transferring contracts. For example, if a request rc1 creates a contract c and another request rc2 archives it while deleteSince is running for some rc <= rc1, rc2, then there are no guarantees which of the effects of rc1 and rc2 remain. For example, c could end up being inexistent, active, or archived but never created, even if the writes for rc1 and rc2 are successful.

  7. abstract def doPrune(beforeAndIncluding: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[Future, AcsError, Unit]

    Deletes all entries about archived contracts whose status hasn't changed after the timestamp.

    Deletes all entries about archived contracts whose status hasn't changed after the timestamp.

    The caller must ensure that the given timestamp is at most the one of the clean cursor in the com.digitalasset.canton.participant.protocol.RequestJournal

    Attributes
    protected[canton]
    Definition Classes
    ActiveContractStorePrunableByTime
  8. implicit abstract val ec: ExecutionContext
    Attributes
    protected
    Definition Classes
    PrunableByTime
  9. abstract def fetchStates(contractIds: Iterable[LfContractId])(implicit traceContext: TraceContext): Future[Map[LfContractId, ContractState]]

    Returns the latest com.digitalasset.canton.participant.store.ActiveContractStore.Status for the given contract IDs along with its com.digitalasset.canton.participant.util.TimeOfChange.

    Returns the latest com.digitalasset.canton.participant.store.ActiveContractStore.Status for the given contract IDs along with its com.digitalasset.canton.participant.util.TimeOfChange.

    This method is used by the protocol processors for conflict detection. In-flight transactions may have changesets not yet written to the ACS datastore. Since only the com.digitalasset.canton.participant.protocol.conflictdetection.ConflictDetector tracks in-flight changesets, this method cannot be used as a source of valid data to other components.

    If a contract is created or transferred-in and archived or transferred-out at the same com.digitalasset.canton.participant.util.TimeOfChange, the contract is ActiveContractStore.Archived or ActiveContractStore.TransferredAway. A contract cannot be archived and transferred out at the same timestamp.

    returns

    The map from contracts in contractIds in the store to their latest state. Nonexistent contracts are excluded from the map.

    Definition Classes
    ActiveContractStoreConflictDetectionStore
    See also

    ActiveContractSnapshot!.snapshot

  10. abstract def packageUsage(pkg: PackageId, contractStore: ContractStore)(implicit traceContext: TraceContext): Future[Option[LfContractId]]

    Returns Some(contractId) if an active contract belonging to package pkg exists, otherwise returns None.

    Returns Some(contractId) if an active contract belonging to package pkg exists, otherwise returns None. The returned contractId may be any active contract from package pkg. The most recent contract state is used.

    Definition Classes
    ActiveContractSnapshot
  11. abstract def pruningStatus(implicit traceContext: TraceContext): EitherT[Future, AcsError, Option[PruningStatus]]

    Returns the latest timestamp at which pruning was started or completed.

    Returns the latest timestamp at which pruning was started or completed. For com.digitalasset.canton.pruning.PruningPhase.Started, it is guaranteed that no pruning has been run on the store after the returned timestamp. For com.digitalasset.canton.pruning.PruningPhase.Completed, it is guaranteed that the store is pruned at least up to the returned timestamp (inclusive). That is, another pruning with the returned timestamp (or earlier) has no effect on the store. Returns scala.None$ if no pruning has ever been started on the store.

    Definition Classes
    PrunableByTime
  12. abstract def snapshot(timestamp: CantonTimestamp)(implicit traceContext: TraceContext): Future[Either[AcsError, SortedMap[LfContractId, CantonTimestamp]]]

    Returns all contracts that were active right after the given timestamp, and when the contract became active for the last time before or at the given timestamp.

    Returns all contracts that were active right after the given timestamp, and when the contract became active for the last time before or at the given timestamp.

    timestamp

    The timestamp at which the snapshot shall be taken. Must be before the timestamp that corresponds to the head cursor in the com.digitalasset.canton.participant.protocol.RequestJournal for the state com.digitalasset.canton.participant.protocol.RequestJournal.RequestState.Clean. If this precondition is violated, the returned snapshot may be inconsistent, i.e., it may omit some contracts that were ActiveContractStore.Active at the given time and it may include contracts that were actually ActiveContractStore.Archived or ActiveContractStore.TransferredAway.

    returns

    A map from contracts to the latest timestamp (no later than the given timestamp) when they became active again. It contains exactly those contracts that were active right after the given timestamp. If a contract is created or transferred-in and archived or transferred-out at the same timestamp, it does not show up in any snapshot. The map is sorted by cats.kernel.Order[com.digitalasset.canton.protocol.LfContractId].

    Definition Classes
    ActiveContractSnapshot
  13. abstract def transferInContracts(transferIns: Seq[(LfContractId, DomainId)], toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Marks the given contracts as transferred in from toc's timestamp (inclusive) onwards.

    Marks the given contracts as transferred in from toc's timestamp (inclusive) onwards.

    transferIns

    The contract IDs to transfer in and their origin domains.

    toc

    The time of change consisting of

    • The request counter of the transfer-in request.
    • The timestamp on the transfer-in request.
    returns

    The future completes when the contract states have been updated. The following irregularities are reported:

  14. abstract def transferOutContracts(transferOuts: Seq[(LfContractId, DomainId)], toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Marks the given contracts as ActiveContractStore.TransferredAway from toc's timestamp (inclusive) onwards.

    Marks the given contracts as ActiveContractStore.TransferredAway from toc's timestamp (inclusive) onwards.

    transferOuts

    The contract IDs to transfer out and their target domains.

    toc

    The time of change consisting of

    • The request counter of the transfer-out request.
    • The timestamp on the transfer-out request.
    returns

    The future completes when the contract state has been updated. The following irregularities are reported:

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def archiveContract(contractId: LfContractId, toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Shorthand for archiveContracts(Seq(contractId), toc)

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. def createContract(contractId: LfContractId, toc: TimeOfChange)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]

    Shorthand for createContracts(Seq(contractId), toc)

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def fetchState(id: LfContractId)(implicit traceContext: TraceContext): Future[Option[StateChange[Status]]]

    Short-hand for fetchStates for a single identifier

    Short-hand for fetchStates for a single identifier

    Definition Classes
    ConflictDetectionStore
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def prune(limit: CantonTimestamp)(implicit traceContext: TraceContext): EitherT[Future, AcsError, Unit]

    Prune all unnecessary data relating to events before the given timestamp.

    Prune all unnecessary data relating to events before the given timestamp.

    The meaning of "unnecessary", and whether the limit is inclusive or exclusive both depend on the particular store. The store must implement the actual pruning logic in the doPrune method.

    Definition Classes
    PrunableByTime
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. def transferInContract(contractId: LfContractId, toc: TimeOfChange, originDomain: DomainId)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]
  21. def transferOutContract(contractId: LfContractId, toc: TimeOfChange, targetDomain: DomainId)(implicit traceContext: TraceContext): CheckedT[Future, AcsError, AcsWarning, Unit]
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from PrunableByTime[AcsError]

Inherited from ActiveContractSnapshot

Inherited from AnyRef

Inherited from Any

Ungrouped