forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update participant state v2 interfaces (digital-asset#1800)
Moves party allocation to its own WriteService trait (similar to package upload). Changes uploadDar to uploadPackages, so that the write service does not depend on the DAR file format. Adds or improves many comments.
- Loading branch information
1 parent
d24366f
commit 77d9162
Showing
17 changed files
with
281 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
...rticipant-state/src/main/scala/com/daml/ledger/participant/state/v2/UploadDarResult.scala
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...pant-state/src/main/scala/com/daml/ledger/participant/state/v2/UploadPackagesResult.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.participant.state.v2 | ||
|
||
sealed abstract class UploadPackagesResult extends Product with Serializable { | ||
def description: String | ||
} | ||
|
||
object UploadPackagesResult { | ||
|
||
/** The package was successfully uploaded */ | ||
final case object Ok extends UploadPackagesResult { | ||
override def description: String = "Packages successfully uploaded" | ||
} | ||
|
||
/** One of the uploaded packages is not valid */ | ||
final case class InvalidPackage(reason: String) extends UploadPackagesResult { | ||
override def description: String = "Uploaded packages were invalid: " + reason | ||
} | ||
|
||
/** The participant was not authorized to submit the upload request */ | ||
final case object ParticipantNotAuthorized extends UploadPackagesResult { | ||
override def description: String = "Participant is not authorized to upload packages" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...icipant-state/src/main/scala/com/daml/ledger/participant/state/v2/WritePartyService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.participant.state.v2 | ||
|
||
import java.util.concurrent.CompletionStage | ||
|
||
/** An interface for on-boarding parties via a participant. */ | ||
trait WritePartyService { | ||
|
||
/** | ||
* 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 | ||
* | ||
* The result of the party allocation is communicated synchronously. | ||
* TODO: consider also providing an asynchronous response in a similar | ||
* manner as it is done for transaction submission. It is possible that | ||
* in some implementations, party allocation will fail due to authorization etc. | ||
* | ||
* Successful party allocations will result in a [[Update.PartyAddedToParticipant]] | ||
* message. See the comments on [[ReadService.stateUpdates]] and [[Update]] for | ||
* further details. | ||
* | ||
* @param hint : A party identifier suggestion | ||
* | ||
* @param displayName : A human readable name of the new party | ||
* | ||
* @return an async result of a PartyAllocationResult | ||
*/ | ||
def allocateParty( | ||
hint: Option[String], | ||
displayName: Option[String] | ||
): CompletionStage[PartyAllocationResult] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.