trait SyncService extends SubmissionSyncService with PackageSyncService with PartySyncService with ParticipantPruningSyncService with ReportsHealth with InternalStateServiceProvider
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 SyncService!.submitTransaction
- allocating a new party using PartySyncService!.allocateParty
- pruning a participant ledger using ParticipantPruningSyncService!.prune
- Alphabetic
- By Inheritance
- SyncService
- InternalStateServiceProvider
- ReportsHealth
- ParticipantPruningSyncService
- PartySyncService
- PackageSyncService
- SubmissionSyncService
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def allocateParty(hint: Party, submissionId: SubmissionId, externalPartyOnboardingDetails: Option[ExternalPartyOnboardingDetails])(implicit traceContext: TraceContext): FutureUnlessShutdown[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 com.digitalasset.canton.ledger.participant.state.Update.PartyAddedToParticipant message. See the comments on com.digitalasset.canton.ledger.participant.state.Update for further details.
- hint
A party identifier suggestion
- submissionId
Client picked submission identifier for matching the responses with the request.
- externalPartyOnboardingDetails
Onboarding information when allocating an external party
- returns
an async result of a SubmissionResult
- Definition Classes
- PartySyncService
- abstract def computeHighestRankedSynchronizerFromAdmissible(submitterInfo: SubmitterInfo, transaction: LfSubmittedTransaction, transactionMeta: TransactionMeta, admissibleSynchronizers: NonEmpty[Set[SynchronizerId]], disclosedContractIds: List[LfContractId], routingSynchronizerState: RoutingSynchronizerState)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, TransactionRoutingError, SynchronizerId]
Computes the highest ranked synchronizer from the given admissible synchronizers without performing topology checks.
Computes the highest ranked synchronizer from the given admissible synchronizers without performing topology checks.
This method is used internally in command processing to pre-select a synchronizer for determining the package preference set used in command interpretation.
For the definitive synchronizer selection to be used for routing of a submitted transaction, use selectRoutingSynchronizer.
- submitterInfo
The submitter info
- transaction
The submitted transaction
- transactionMeta
The transaction metadata
- admissibleSynchronizers
The list of synchronizers from which the best one should be selected
- disclosedContractIds
The list of disclosed contracts used in command interpretation
- routingSynchronizerState
The routing synchronizer state the computation should be based on
- returns
The ID of the best ranked synchronizer
- abstract def currentHealth(): HealthStatus
Reports the current health of the object.
Reports the current health of the object. This should always return immediately.
- Definition Classes
- ReportsHealth
- abstract def getRoutingSynchronizerState(implicit traceContext: TraceContext): RoutingSynchronizerState
Constructs and fetches the current synchronizer state, to be used throughout command execution
- abstract def internalStateService: Option[InternalStateService]
- Definition Classes
- InternalStateServiceProvider
- abstract def packageMapFor(submitters: Set[LfPartyId], informees: Set[LfPartyId], vettingValidityTimestamp: CantonTimestamp, prescribedSynchronizer: Option[SynchronizerId], routingSynchronizerState: RoutingSynchronizerState)(implicit traceContext: TraceContext): FutureUnlessShutdown[Map[SynchronizerId, Map[LfPartyId, Set[LfPackageId]]]]
Computes a SynchronizerId -> PartyId -> PackageId relation that describes:
Computes a SynchronizerId -> PartyId -> PackageId relation that describes:
- for each synchronizer that hosts all the provided
submitters
that can submit. The providedsubmitters
can be empty (for externally signed transactions), in which case synchronizers are not restricted by parties with submission rights on the local participant - which package-ids can be accepted (i.e. they are vetting-valid) in a transaction by each of the informees provided
- if the prescribed synchronizer is provided, only that one is considered
- for each synchronizer that hosts all the provided
- abstract def protocolVersionForSynchronizerId(synchronizerId: SynchronizerId): Option[ProtocolVersion]
Return the protocol version for a synchronizer ID if the node is connected to it.
Return the protocol version for a synchronizer ID if the node is connected to it.
- Definition Classes
- PartySyncService
- 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 divulged contracts created before
pruneUpToInclusive
independent of whether they were archived beforepruneUpToInclusive
.- returns
The pruning result.
- Definition Classes
- ParticipantPruningSyncService
- abstract def registerInternalStateService(internalStateService: InternalStateService): Unit
- Definition Classes
- InternalStateServiceProvider
- abstract def selectRoutingSynchronizer(submitterInfo: SubmitterInfo, transaction: LfSubmittedTransaction, transactionMeta: TransactionMeta, disclosedContractIds: List[LfContractId], optSynchronizerId: Option[SynchronizerId], transactionUsedForExternalSigning: Boolean, routingSynchronizerState: RoutingSynchronizerState)(implicit traceContext: TraceContext): EitherT[FutureUnlessShutdown, TransactionError, SynchronizerRank]
Computes the best synchronizer for a submitted transaction by checking the submitted transaction against the topology of the connected synchronizers and ranking the admissible ones using the synchronizer ranking (by priority, minimum number of reassignments and synchronizer-id).
Computes the best synchronizer for a submitted transaction by checking the submitted transaction against the topology of the connected synchronizers and ranking the admissible ones using the synchronizer ranking (by priority, minimum number of reassignments and synchronizer-id).
- submitterInfo
The submitter info
- transaction
The submitted transaction
- transactionMeta
The transaction metadata
- disclosedContractIds
The list of disclosed contracts used in command interpretation
- optSynchronizerId
If provided, only this synchronizer id is considered as a candidate for routing
- transactionUsedForExternalSigning
If true, the topology checks do not required that the submitters of the transaction have submission rights on the local participant since they are supposed to externally sign the transaction.
- returns
The rank of the routing synchronizer
- abstract def submitReassignment(submitter: Party, userId: daml.lf.data.Ref.UserId, commandId: daml.lf.data.Ref.CommandId, submissionId: Option[SubmissionId], workflowId: Option[daml.lf.data.Ref.WorkflowId], reassignmentCommands: Seq[ReassignmentCommand])(implicit traceContext: TraceContext): CompletionStage[SubmissionResult]
Submit a reassignment command for acceptance to the ledger.
Submit a reassignment command for acceptance to the ledger.
To complete a reassignment, first a submission of an unassign command followed by an assign command is required. The com.digitalasset.canton.ledger.participant.state.ReassignmentCommand.Assign command must include the unassign ID which can be observed in the accepted event marking the corresponding successful unassign command.
- submitter
The submitter of the reassignment.
- userId
An identifier for the user that submitted the command. This is used for monitoring, command deduplication, and to allow Daml applications subscribe to their own submissions only.
- commandId
A submitter-provided identifier to identify an intended ledger change within all the submissions by the same parties and application.
- submissionId
An identifier for the submission that allows an application to correlate completions to its submissions.
- workflowId
A submitter-provided identifier used for monitoring and to traffic-shape the work handled by Daml applications communicating over the ledger.
- reassignmentCommands
The commands specifying this reassignment further.
- Definition Classes
- SubmissionSyncService
- abstract def submitTransaction(transaction: SubmittedTransaction, synchronizerRank: SynchronizerRank, routingSynchronizerState: RoutingSynchronizerState, submitterInfo: SubmitterInfo, transactionMeta: TransactionMeta, _estimatedInterpretationCost: Long, keyResolver: LfKeyResolver, processedDisclosedContracts: ImmArray[FatContractInstance])(implicit traceContext: TraceContext): 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 sequence of com.digitalasset.canton.ledger.participant.state.Update implementation backed by the same participant state as this com.digitalasset.canton.ledger.participant.state.SyncService. Successful transaction acceptance is communicated using a com.digitalasset.canton.ledger.participant.state.Update.TransactionAccepted message. Failed transaction acceptance is communicated when possible via a com.digitalasset.canton.ledger.participant.state.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 com.digitalasset.canton.ledger.participant.state.Update.CommandRejected is generated. See the comments on com.digitalasset.canton.ledger.participant.state.Update for further details.A note on ledger time and record time: transactions are submitted together with a
ledgerTime
provided as part of thetransactionMeta
information. The ledger time is used by the Daml Engine to resolve calls to thegetTime :: 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 ofgetTime
quite surprising. We've chosen the following solution to provide useful guarantees for contracts relying ongetTime
.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 com.digitalasset.canton.ledger.participant.state.SyncService is responsible for deduplicating commands with the same com.digitalasset.canton.ledger.participant.state.SubmitterInfo.changeId within the com.digitalasset.canton.ledger.participant.state.SubmitterInfo.deduplicationPeriod.
- 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.
- synchronizerRank
The synchronizer rank based on which:
- the participant performs the required reassignments of the transaction's input contracts
- the participant routes the transaction to the synchronizer
- routingSynchronizerState
The synchronizer state used for synchronizer selection. This is subsequently used for synchronizer routing.
- submitterInfo
the information provided by the submitter for correlating this submission with its acceptance or rejection on the associated com.digitalasset.canton.ledger.participant.state.Update.
- transactionMeta
the meta-data accessible to all consumers of the transaction. See com.digitalasset.canton.ledger.participant.state.TransactionMeta for more information.
- _estimatedInterpretationCost
Estimated cost of interpretation that may be used for handling submitted transactions differently.
- keyResolver
Input key mapping inferred by interpretation. The map should contain all contract keys that were used during interpretation. A value of None means no contract was found with this contract key.
- processedDisclosedContracts
Explicitly disclosed contracts used during interpretation.
- Definition Classes
- SubmissionSyncService
- abstract def unregisterInternalStateService(): Unit
- Definition Classes
- InternalStateServiceProvider
- abstract def uploadDar(dars: Seq[ByteString], submissionId: SubmissionId)(implicit traceContext: TraceContext): Future[SubmissionResult]
Upload a DAR to the ledger.
Upload a DAR to the ledger.
This method must be thread-safe, not throw, and not block on IO. It is though allowed to perform significant computation.
- submissionId
Submitter chosen submission identifier.
- returns
an async result of a com.digitalasset.canton.ledger.participant.state.SubmissionResult
- Definition Classes
- PackageSyncService
Concrete 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 clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getConnectedSynchronizers(request: ConnectedSynchronizerRequest)(implicit traceContext: TraceContext): FutureUnlessShutdown[ConnectedSynchronizerResponse]
- def getLfArchive(packageId: PackageId)(implicit traceContext: TraceContext): Future[Option[Archive]]
- Definition Classes
- PackageSyncService
- def getPackageMetadataSnapshot(implicit errorLoggingContext: ErrorLoggingContext): PackageMetadata
- Definition Classes
- PackageSyncService
- def getProtocolVersionForSynchronizer(synchronizerId: Traced[SynchronizerId]): Option[ProtocolVersion]
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def incompleteReassignmentOffsets(validAt: Offset, stakeholders: Set[LfPartyId])(implicit traceContext: TraceContext): FutureUnlessShutdown[Vector[Offset]]
Get the offsets of the incomplete assigned/unassigned events for a set of stakeholders.
Get the offsets of the incomplete assigned/unassigned events for a set of stakeholders.
- validAt
The offset of validity in participant offset terms.
- stakeholders
Only offsets are returned which have at least one stakeholder from this set.
- returns
All the offset of assigned/unassigned events which do not have their counterparts visible at the validAt offset, and only for the reassignments for which this participant is reassigning.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def listLfPackages()(implicit traceContext: TraceContext): Future[Seq[PackageDescription]]
- Definition Classes
- PackageSyncService
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def validateDar(dar: ByteString, darName: String)(implicit traceContext: TraceContext): Future[SubmissionResult]
- Definition Classes
- PackageSyncService
- 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])