Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package daml
    Definition Classes
    com
  • package ledger
    Definition Classes
    daml
  • package participant
    Definition Classes
    ledger
  • package state
    Definition Classes
    participant
  • package v2

    Interfaces to read from and write to an (abstract) participant state.

    Interfaces to read from and write to an (abstract) participant state.

    A Daml ledger participant is code that allows to actively participate in the evolution of a shared Daml ledger. Each such participant maintains a particular view onto the state of the Daml ledger. We call this view the participant state.

    Actual implementations of a Daml ledger participant will likely maintain more state than what is exposed through the interfaces in this package, which is why we talk about an abstract participant state. It abstracts over the different implementations of Daml ledger participants.

    The interfaces are optimized for easy implementation. The v2.WriteService interface contains the methods for changing the participant state (and potentially the state of the Daml ledger), which all ledger participants must support. These methods are for example exposed via the Daml Ledger API. Actual ledger participant implementations likely support more implementation-specific methods. They are however not exposed via the Daml Ledger API. The v2.ReadService interface contains the one method v2.ReadService.stateUpdates to read the state of a ledger participant. It represents the participant state as a stream of v2.Updates to an initial participant state. The typical consumer of this method is a class that subscribes to this stream of v2.Updates and reconstructs (a view of) the actual participant state. See the comments on v2.Update and v2.ReadService.stateUpdates for details about the kind of updates and the guarantees given to consumers of the stream of v2.Updates.

    We do expect the interfaces provided in com.daml.ledger.participant.state to evolve, which is why we provide them all in the com.daml.ledger.participant.state.v2 package. Where possible we will evolve them in a backwards compatible fashion, so that a simple recompile suffices to upgrade to a new version. Where that is not possible, we plan to introduce new version of this API in a separate package and maintain it side-by-side with the existing version if possible. There can therefore potentially be multiple versions of participant state APIs at the same time. We plan to deprecate and drop old versions on separate and appropriate timelines.

    Definition Classes
    state
  • ChangeId
  • CompletionInfo
  • DivulgedContract
  • PruningResult
  • ReadService
  • SubmissionResult
  • SubmitterInfo
  • TransactionMeta
  • Update
  • WriteConfigService
  • WritePackagesService
  • WriteParticipantPruningService
  • WritePartyService
  • WriteService

trait WriteService extends WritePackagesService with WritePartyService with WriteConfigService with WriteParticipantPruningService with ReportsHealth

An interface to change a ledger via a participant. Please note that this interface is unstable and may significantly change.

The methods in this interface are all methods that are supported *uniformly* across all ledger participant implementations. Methods for uploading packages, on-boarding parties, and changing ledger-wide configuration are specific to a ledger and therefore to a participant implementation. Moreover, these methods usually require admin-level privileges, whose granting is also specific to a ledger.

If a ledger is run for testing only, there is the option for quite freely allowing the on-boarding of parties and uploading of packages. There are plans to make this functionality uniformly available: see the roadmap for progress information https://github.com/digital-asset/daml/issues/121.

The following methods are currently available for changing the state of a Daml ledger: - submitting a transaction using WriteService!.submitTransaction - allocating a new party using WritePartyService!.allocateParty - uploading a new package using WritePackagesService!.uploadPackages - pruning a participant ledger using WriteParticipantPruningService!.prune

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WriteService
  2. ReportsHealth
  3. WriteParticipantPruningService
  4. WriteConfigService
  5. WritePartyService
  6. WritePackagesService
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def allocateParty(hint: Option[Party], displayName: Option[String], submissionId: SubmissionId)(implicit loggingContext: LoggingContext, telemetryContext: TelemetryContext): CompletionStage[SubmissionResult]

    Adds a new party to the set managed by the ledger.

    Adds a new party to the set managed by the ledger.

    Caller specifies a party identifier suggestion, the actual identifier allocated might be different and is implementation specific.

    In particular, a ledger may: - Disregard the given hint and choose a completely new party identifier - Construct a new unique identifier from the given hint, e.g., by appending a UUID - Use the given hint as is, and reject the call if such a party already exists

    Successful party allocations will result in a Update.PartyAddedToParticipant message. See the comments on ReadService.stateUpdates and Update for further details.

    hint

    A party identifier suggestion

    displayName

    A human readable name of the new party

    submissionId

    Client picked submission identifier for matching the responses with the request.

    returns

    an async result of a SubmissionResult

    Definition Classes
    WritePartyService
  2. abstract def currentHealth(): HealthStatus
    Definition Classes
    ReportsHealth
  3. abstract def prune(pruneUpToInclusive: Offset, submissionId: SubmissionId, pruneAllDivulgedContracts: Boolean): CompletionStage[PruningResult]

    Prune the participant ledger specifying the offset up to which participant ledger events can be removed.

    Prune the participant ledger specifying the offset up to which participant ledger events can be removed.

    As this interface applies only to the local participant unlike other administrator services, returns a (completion stage of a) PruningResult rather than a SubmissionResult.

    Ledgers that do not elect to support participant pruning, return NotPruned(Status.UNIMPLEMENTED). Returning an error also keeps the ledger api server from pruning its index.

    Ledgers whose participants hold no participant-local state, but want the ledger api server to prune, return ParticipantPruned.

    For pruning implementations to be fault tolerant, the following aspects are important: - Consider failing a prune request before embarking on destructive operations for example if certain safety conditions are not met (such as being low on resources). This helps minimize the chances of partially performed prune operations. If the system cannot prune up to the specified offset, the call should not alter the system and return NotPruned rather than prune partially. - Implement pruning either atomically (performing all operations or none), or break down pruning steps into idempotent pieces that pick up after retries or system recovery in case of a mid-pruning crash. - To the last point, be aware that pruning of the ledger api server index happens in such an idempotent follow-up step upon successful completion of each prune call. To reach eventual consistency upon failures, be sure to return ParticipantPruned even if the specified offset has already been pruned to allow ledger api server index pruning to proceed in case of an earlier failure.

    pruneUpToInclusive

    The offset up to which contracts should be pruned.

    submissionId

    The submission id.

    pruneAllDivulgedContracts

    If set, instruct the ledger to prune all immediately and retroactively divulged contracts created before pruneUpToInclusive independent of whether they were archived before pruneUpToInclusive.

    returns

    The pruning result.

    Definition Classes
    WriteParticipantPruningService
  4. abstract def submitConfiguration(maxRecordTime: Timestamp, submissionId: SubmissionId, config: Configuration)(implicit loggingContext: LoggingContext, telemetryContext: TelemetryContext): CompletionStage[SubmissionResult]

    Submit a new configuration to the ledger.

    Submit a new configuration to the ledger. If the configuration is accepted a Update.ConfigurationChanged event will be emitted to all participants. In case of rejection a Update.ConfigurationChangeRejected will be emitted.

    The Configuration contains the identity of the participant that is allowed to further change the configuration. The initial configuration can be submitted by any participant.

    If configuration changes are not supported by the implementation then the SubmissionResult.SynchronousError should be returned. *

    returns

    an async result of a SubmissionResult

    Definition Classes
    WriteConfigService
  5. abstract def submitTransaction(submitterInfo: SubmitterInfo, transactionMeta: TransactionMeta, transaction: SubmittedTransaction, estimatedInterpretationCost: Long)(implicit loggingContext: LoggingContext, telemetryContext: TelemetryContext): CompletionStage[SubmissionResult]

    Submit a transaction for acceptance to the ledger.

    Submit a transaction for acceptance to the ledger.

    This method must be thread-safe.

    The result of the transaction submission is communicated asynchronously via a ReadService implementation backed by the same participant state as this WriteService. Successful transaction acceptance is communicated using a Update.TransactionAccepted message. Failed transaction acceptance is communicated when possible via a Update.CommandRejected message referencing the same submitterInfo as provided in the submission. There can be failure modes where a transaction submission is lost in transit, and no Update.CommandRejected is generated. See the comments on ReadService.stateUpdates for further details.

    A note on ledger time and record time: transactions are submitted together with a ledgerTime provided as part of the transactionMeta information. The ledger time is used by the Daml Engine to resolve calls to the getTime :: Update Time function. Letting the submitter freely choose the ledger time is though a problem for the other stakeholders in the contracts affected by the submitted transaction. The submitter can in principle choose to submit transactions that are effective far in the past or future relative to the wall-clock time of the other participants. This gives the submitter an unfair advantage and make the semantics of getTime quite surprising. We've chosen the following solution to provide useful guarantees for contracts relying on getTime.

    The ledger is charged with (1) associating record-time stamps to accepted transactions and (2) to provide a guarantee on the maximal skew between the ledger effective time and the record time stamp associated to an accepted transaction. The ledger is also expected to provide guarantees on the distribution of the maximal skew between record time stamps on accepted transactions and the wall-clock time at delivery of accepted transactions to a ledger participant. Thereby providing ledger participants with a guarantee on the maximal skew between the ledger effective time of an accepted transaction and the wall-clock time at delivery to these participants.

    Concretely, we typically expect the allowed skew between record time and ledger time to be in the minute range. Thereby leaving ample time for submitting and validating large transactions before they are timestamped with their record time.

    The WriteService is responsible for deduplicating commands with the same SubmitterInfo.changeId within the SubmitterInfo.deduplicationPeriod.

    submitterInfo

    the information provided by the submitter for correlating this submission with its acceptance or rejection on the associated ReadService.

    transactionMeta

    the meta-data accessible to all consumers of the transaction. See TransactionMeta for more information.

    transaction

    the submitted transaction. This transaction can contain local contract-ids that need suffixing. The participant state may have to suffix those contract-ids in order to guaranteed their global uniqueness. See the Contract Id specification for more detail daml-lf/spec/contract-id.rst.

    estimatedInterpretationCost

    Estimated cost of interpretation that may be used for handling submitted transactions differently.

  6. abstract def uploadPackages(submissionId: SubmissionId, archives: List[Archive], sourceDescription: Option[String])(implicit loggingContext: LoggingContext, telemetryContext: TelemetryContext): CompletionStage[SubmissionResult]

    Upload a collection of Daml-LF packages to the ledger.

    Upload a collection of Daml-LF packages to the ledger.

    This method must be thread-safe, not throw, and not block on IO. It is though allowed to perform significant computation.

    Successful archives upload will result in a Update.PublicPackageUpload message. See the comments on ReadService.stateUpdates and Update for further details.

    Note: we accept Archives rather than parsed packages, because we want to be able to get the byte size of each individual ArchivePayload, which is information that the read / index service need to provide. Moreover this information should be consistent with the payload that the com.daml.ledger.api.v1.package_service.GetPackageResponse contains. If we were to consume packages we'd have to re-encode them to provide the size, and the size might potentially be different from the original size, which would be quite confusing.

    submissionId

    Submitter chosen submission identifier.

    archives

    Daml-LF archives to be uploaded to the ledger. All archives must be valid, i.e., they must successfully decode and pass Daml engine validation.

    sourceDescription

    Description provided by the backing participant describing where it got the package from, e.g., when, where, or by whom the packages were uploaded.

    returns

    an async result of a SubmissionResult

    Definition Classes
    WritePackagesService

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. 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 ReportsHealth

Inherited from WriteConfigService

Inherited from WritePartyService

Inherited from WritePackagesService

Inherited from AnyRef

Inherited from Any

Ungrouped