ledger-service, navigator: Damlification of Scala files (#9669)

* Damlification of Scala files (primarily comments and strings).

* Comment tidying.
CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Miklos 2021-05-20 11:14:13 +02:00 committed by GitHub
parent f947c02c74
commit 3bf6531e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 41 additions and 41 deletions

View File

@ -49,7 +49,7 @@ object EndpointsCompanion {
private[http] implicit val jwtWriteParsePayload: ParsePayload[JwtWritePayload] =
new ParsePayload[JwtWritePayload] {
override def parsePayload(jwt: DecodedJwt[String]): Unauthorized \/ JwtWritePayload = {
// AuthServiceJWTCodec is the JWT reader used by the sandbox and some DAML-on-X ledgers.
// AuthServiceJWTCodec is the JWT reader used by the sandbox and some Daml-on-X ledgers.
// Most JWT fields are optional for the sandbox, but not for the JSON API.
AuthServiceJWTCodec
.readFromString(jwt.payload)
@ -79,7 +79,7 @@ object EndpointsCompanion {
private[http] implicit val jwtParsePayload: ParsePayload[JwtPayload] =
new ParsePayload[JwtPayload] {
override def parsePayload(jwt: DecodedJwt[String]): Unauthorized \/ JwtPayload = {
// AuthServiceJWTCodec is the JWT reader used by the sandbox and some DAML-on-X ledgers.
// AuthServiceJWTCodec is the JWT reader used by the sandbox and some Daml-on-X ledgers.
// Most JWT fields are optional for the sandbox, but not for the JSON API.
AuthServiceJWTCodec
.readFromString(jwt.payload)

View File

@ -109,7 +109,7 @@ class ApiCodecCompressed[Cid](val encodeDecimalAsString: Boolean, val encodeInt6
)
// ------------------------------------------------------------------------------------------------------------------
// Decoding - this needs access to DAML-LF types
// Decoding - this needs access to Daml-LF types
// ------------------------------------------------------------------------------------------------------------------
@throws[DeserializationException]

View File

@ -12,8 +12,8 @@ import value.{Value => V}
*/
trait NavigatorModelAliases[Cid] {
/** An absolute reference of a DAML-LF entity.
* Contains a DAML-LF package ID and a qualified name.
/** An absolute reference of a Daml-LF entity.
* Contains a Daml-LF package ID and a qualified name.
* Currently, such identifiers can point to:
* - Templates
* - User-defined records
@ -22,7 +22,7 @@ trait NavigatorModelAliases[Cid] {
type DamlLfIdentifier = DamlLfRef.Identifier
val DamlLfIdentifier = DamlLfRef.Identifier
/** A simple DAML-LF type
/** A simple Daml-LF type
* Currently, these can be:
* - Primitive types
* - Type constructor applications (i.e., dereferencing a DamlLfIdentifier)
@ -43,25 +43,25 @@ trait NavigatorModelAliases[Cid] {
type DamlLfPrimType = iface.PrimType
val DamlLfPrimType = iface.PrimType
/** A user-defined DAML-LF type (closed form). Can be a record or variant. */
/** A user-defined Daml-LF type (closed form). Can be a record or variant. */
type DamlLfDataType = iface.DataType.FWT
val DamlLfDataType = iface.DataType
/** A user-defined DAML-LF type (generic form). Can be a record or variant. */
/** A user-defined Daml-LF type (generic form). Can be a record or variant. */
type DamlLfDefDataType = iface.DefDataType.FWT
val DamlLfDefDataType = iface.DefDataType
type DamlLfTypeLookup = DamlLfIdentifier => Option[DamlLfDefDataType]
/** A user-defined DAML-LF record */
/** A user-defined Daml-LF record */
type DamlLfRecord = iface.Record.FWT
val DamlLfRecord = iface.Record
/** A user-defined DAML-LF variant */
/** A user-defined Daml-LF variant */
type DamlLfVariant = iface.Variant.FWT
val DamlLfVariant = iface.Variant
/** A user-defined DAML-LF enum */
/** A user-defined Daml-LF enum */
type DamlLfEnum = iface.Enum
val DamlLfEnum = iface.Enum

View File

@ -222,7 +222,7 @@ class ApiCodecCompressedSpec
(typ, v: Any, typ.inj(v))
val roundtrips = Table(
("type", "original value", "DAML value"),
("type", "original value", "Daml value"),
cr(C.emptyRecordT)(HRecord()),
cr(C.simpleRecordT)(C.simpleRecordV),
cr(C.simpleVariantT)(C.simpleVariantV),

View File

@ -96,7 +96,7 @@ object JsonType {
val ApiRecordType: ScalarType[ApiRecord] = newScalarType[ApiRecord]("DamlLfValueRecord")
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF types
// Daml-LF types
// ------------------------------------------------------------------------------------------------------------------
val DamlLfTypeType: ScalarType[DamlLfType] = newScalarType[DamlLfType]("DamlLfType")
val DamlLfDataTypeType: ScalarType[DamlLfDataType] =

View File

@ -8,7 +8,7 @@ import com.daml.navigator.json.Util._
import com.daml.navigator.{model => Model}
import spray.json._
/** An encoding of DAML-LF types.
/** An encoding of Daml-LF types.
*
* The types are encoded as-is (no type variables substitution, no type reference resolution).
*/

View File

@ -60,7 +60,7 @@ final case class CommandStatusUnknown() extends CommandStatus {
sealed trait Command extends TaggedNode[ApiTypes.CommandIdTag] {
/** Order in which the command was submitted */
/** Order in which the command was submitted. */
def index: Long
def workflowId: ApiTypes.WorkflowId
def platformTime: Instant
@ -96,7 +96,7 @@ final case class Result(id: ApiTypes.CommandId, errorOrTx: Either[Error, Transac
extends TaggedNode[ApiTypes.CommandIdTag]
// ------------------------------------------------------------------------------------------------
// DAML Package
// Daml Package
// ------------------------------------------------------------------------------------------------
case class DamlLfPackage(
@ -131,13 +131,13 @@ final case class Transaction(
sealed trait Event extends TaggedNode[ApiTypes.EventIdTag] {
def workflowId: ApiTypes.WorkflowId
/** Id of the parent event in the transaction tree */
/** Id of the parent event in the transaction tree. */
def parentId: Option[ApiTypes.EventId]
/** Id of the transaction tree containing this event */
/** Id of the transaction tree containing this event. */
def transactionId: ApiTypes.TransactionId
/** Determines which parties are notified of this event */
/** Determines which parties are notified of this event. */
def witnessParties: List[ApiTypes.Party]
}

View File

@ -9,7 +9,7 @@ import com.daml.lf.{iface => DamlLfIface}
import com.daml.lf.data.{Ref => DamlLfRef}
import scala.collection.compat.immutable.LazyList
/** Manages a set of known DAML-LF packages. */
/** Manages a set of known Daml-LF packages. */
case class PackageRegistry(
private val packages: Map[DamlLfRef.PackageId, DamlLfPackage] = Map.empty,
private val templates: Map[DamlLfIdentifier, Template] = Map.empty,

View File

@ -31,14 +31,14 @@ package object model extends NavigatorModelAliases[String] {
type WorkflowId = ApiTypes.WorkflowId
// ----------------------------------------------------------------------------------------------
// Types used in DAML-LF
// Types used in Daml-LF
// ----------------------------------------------------------------------------------------------
/** A dot-separated list of strings */
type DamlLfDottedName = DamlLfRef.DottedName
val DamlLfDottedName = DamlLfRef.DottedName
/** A qualified name, referencing entities from the same DAML-LF package */
/** A qualified name, referencing entities from the same Daml-LF package */
type DamlLfQualifiedName = DamlLfRef.QualifiedName
val DamlLfQualifiedName = DamlLfRef.QualifiedName
@ -53,7 +53,7 @@ package object model extends NavigatorModelAliases[String] {
type DamlLfFieldWithType = DamlLfIface.FieldWithType
// ----------------------------------------------------------------------------------------------
// Conversion between API Identifier, DAML-LF Identifier, and String
// Conversion between API Identifier, Daml-LF Identifier, and String
// ----------------------------------------------------------------------------------------------
implicit class IdentifierApiConversions(val id: ApiV1.value.Identifier) extends AnyVal {
def asDaml: DamlLfRef.Identifier =

View File

@ -409,7 +409,7 @@ class PlatformStore(
val index = commandIndex.incrementAndGet()
parseOpaqueIdentifier(templateId).fold({
val msg = s"Create contract command not sent, '$templateId' is not a valid DAML-LF identifier"
val msg = s"Create contract command not sent, '$templateId' is not a valid Daml-LF identifier"
log.warning(msg)
sender ! Failure(StoreException(msg))
})(id => {

View File

@ -19,11 +19,11 @@ import scala.language.implicitConversions
case class DamlConstants()
/** DAML related constants usable in tests
/** Daml related constants usable in tests
*/
case object DamlConstants {
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: Ids
// Daml-LF: Ids
// ------------------------------------------------------------------------------------------------------------------
val packageId0 = DamlLfRef.PackageId.assertFromString("hash")
@ -39,7 +39,7 @@ case object DamlConstants {
val ref2: DamlLfIdentifier = defRef("T2")
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: simple types
// Daml-LF: simple types
// ------------------------------------------------------------------------------------------------------------------
val simpleTextT = DamlLfTypePrim(DamlLfPrimType.Text, DamlLfImmArraySeq())
val simpleInt64T = DamlLfTypePrim(DamlLfPrimType.Int64, DamlLfImmArraySeq())
@ -69,7 +69,7 @@ case object DamlConstants {
)
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: empty record
// Daml-LF: empty record
// ------------------------------------------------------------------------------------------------------------------
val emptyRecordId: DamlLfIdentifier = defRef("EmptyRecord")
val emptyRecordGD = DamlLfRecord(DamlLfImmArraySeq())
@ -79,7 +79,7 @@ case object DamlConstants {
val emptyRecordV = V.ValueRecord(Some(emptyRecordId), ImmArray.empty)
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: simple record (data SimpleRecord a b = {fA: a, fB: b})
// Daml-LF: simple record (data SimpleRecord a b = {fA: a, fB: b})
// ------------------------------------------------------------------------------------------------------------------
val simpleRecordId: DamlLfIdentifier = defRef("SimpleRecord")
val simpleRecordGD = DamlLfRecord(
@ -104,7 +104,7 @@ case object DamlConstants {
)
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: simple variant (data DamlLfVariant a b = fA a | fB b)
// Daml-LF: simple variant (data DamlLfVariant a b = fA a | fB b)
// ------------------------------------------------------------------------------------------------------------------
val simpleVariantId: DamlLfIdentifier = defRef("SimpleVariant")
val simpleVariantGD = DamlLfVariant(
@ -122,7 +122,7 @@ case object DamlConstants {
def simpleVariantV = V.ValueVariant(Some(simpleVariantId), "fA", V.ValueText("foo"))
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: recursive type (data Tree = Leaf a | Node {left: Tree a, right: Tree a})
// Daml-LF: recursive type (data Tree = Leaf a | Node {left: Tree a, right: Tree a})
// ------------------------------------------------------------------------------------------------------------------
val treeNodeId: DamlLfIdentifier = defRef("TreeNode")
val treeId: DamlLfIdentifier = defRef("Tree")
@ -204,7 +204,7 @@ case object DamlConstants {
val redV = V.ValueEnum(Some(colorId), "Red")
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: complex record containing all DAML types
// Daml-LF: complex record containing all Daml types
// ------------------------------------------------------------------------------------------------------------------
val complexRecordId: DamlLfIdentifier = defRef("ComplexRecord")
val complexRecordGD = DamlLfRecord(
@ -262,7 +262,7 @@ case object DamlConstants {
)
// ------------------------------------------------------------------------------------------------------------------
// DAML-LF: package mockup
// Daml-LF: package mockup
// ------------------------------------------------------------------------------------------------------------------
val allTypes: Map[DamlLfIdentifier, DamlLfDefDataType] = Map(
emptyRecordId -> emptyRecordGC,
@ -274,7 +274,7 @@ case object DamlConstants {
colorId -> colorGC,
)
// Note: these templates may not be valid DAML templates
// Note: these templates may not be valid Daml templates
val simpleRecordTemplateId: DamlLfIdentifier = defRef("SimpleRecordTemplate")
private val ChoiceUnit = DamlLfRef.Name.assertFromString("unit")
private val choiceText = DamlLfRef.Name.assertFromString("text")

View File

@ -24,9 +24,9 @@ class DamlLfCodecSpec extends AnyWordSpec with Matchers {
} yield parsed
}
"DAML-LF JSON codec" when {
"Daml-LF JSON codec" when {
"serializing and parsing a DAML-LF object" should {
"serializing and parsing a Daml-LF object" should {
"work for DamlLFIdentifier" in {
serializeAndParse(C.ref0) shouldBe Success(C.ref0)

View File

@ -13,7 +13,7 @@ class ModelSpec extends AnyWordSpec with Matchers {
"Navigator data model" when {
"converting DAML-LF identifiers to API and back" should {
"converting Daml-LF identifiers to API and back" should {
val result = templateId.asApi.asDaml
"not change the value" in {
@ -21,7 +21,7 @@ class ModelSpec extends AnyWordSpec with Matchers {
}
}
"converting DAML-LF identifiers to opaque string and parsing back" should {
"converting Daml-LF identifiers to opaque string and parsing back" should {
val result = parseOpaqueIdentifier(templateId.asOpaqueString)
"not change the value" in {

View File

@ -9,7 +9,7 @@ import java.nio.file.Files
import scala.sys.error
import scala.sys.process.Process
/** Run the HEAD version of damlc from source, to create a DAR file from a DAML file.
/** Run the HEAD version of damlc from source, to create a DAR file from a Daml file.
*/
object HeadDamlc {
private val packageName = "Test"
@ -22,7 +22,7 @@ object HeadDamlc {
tempDirectory.deleteOnExit()
val shutdown: Unit => Unit = _ => { tempDirectory.delete(); () }
// DAML -> DAR
// Daml -> DAR
val exitCode = Process(
s"bazel run damlc -- package $damlPath $packageName --output ${darFile.getAbsolutePath}"
).!

View File

@ -12,7 +12,7 @@ import com.typesafe.scalalogging.LazyLogging
// import scala.sys.error
/** Run a packaged version of damlc to create a DAR file from a DAML file.
/** Run a packaged version of damlc to create a DAR file from a Daml file.
* Update the project dependencies to change the damlc version.
*/
object PackagedDamlc extends LazyLogging {