Skip to content

Commit

Permalink
Remove Sandbox classic stores and related unit tests (#12532)
Browse files Browse the repository at this point in the history
* Remove Sandbox classic stores and related unit tests

changelog_begin
changelog_end

* Add missing test case in SequenceSpec
  • Loading branch information
tudor-da authored Jan 24, 2022
1 parent 24b2325 commit 8d65aa3
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 4,214 deletions.
20 changes: 0 additions & 20 deletions ledger/sandbox-classic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ alias(
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scalaz_scalaz_core",
],
scalacopts = [
Expand All @@ -55,11 +54,7 @@ alias(
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger/caching",
"//ledger/error",
Expand All @@ -68,27 +63,22 @@ alias(
"//ledger/ledger-api-domain",
"//ledger/ledger-api-health",
"//ledger/ledger-configuration",
"//ledger/ledger-offset",
"//ledger/ledger-resources",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state-index",
"//ledger/participant-state/kvutils/app",
"//ledger/sandbox-common:sandbox-common-{}".format(edition),
"//ledger-service/cli-opts",
"//ledger/sandbox-on-x",
"//libs-scala/build-info",
"//libs-scala/concurrent",
"//libs-scala/contextualized-logging",
"//libs-scala/grpc-utils",
"//libs-scala/logging-entries",
"//libs-scala/ports",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_typesafe_config",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:org_slf4j_slf4j_api",
Expand Down Expand Up @@ -132,7 +122,6 @@ da_scala_library(
"@maven//:org_scalatest_scalatest_flatspec",
"@maven//:org_scalatest_scalatest_matchers_core",
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:org_scalatest_scalatest_wordspec",
"@maven//:org_scalaz_scalaz_core",
],
scala_runtime_deps = [
Expand All @@ -146,29 +135,22 @@ da_scala_library(
deps = [
":sandbox-classic",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/error",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-auth-client",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/ledger-api-health",
"//ledger/ledger-configuration",
"//ledger/ledger-resources",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-integration-api:participant-integration-api-tests-lib",
"//ledger/participant-state",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/contextualized-logging",
"//libs-scala/grpc-utils",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
Expand All @@ -177,7 +159,6 @@ da_scala_library(
"//libs-scala/resources-grpc",
"//libs-scala/timer-utils",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:io_netty_netty_handler",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_slf4j_slf4j_api",
Expand Down Expand Up @@ -218,7 +199,6 @@ test_deps = [
"//ledger/ledger-resources:ledger-resources-test-lib",
"//ledger/metrics",
"//ledger/participant-state",
"//ledger/participant-state-index",
"//ledger/participant-state-metrics",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.daml
package platform.sandbox

import platform.sandbox.config.SandboxConfig
import platform.sandbox.config.{LedgerName, SandboxConfig}
import ledger.participant.state.kvutils.app.{
Config,
Mode,
Expand All @@ -20,14 +20,14 @@ import platform.sandbox.config.SandboxConfig.EngineMode
import scalaz.syntax.tag._

import scala.jdk.DurationConverters._
import java.util.UUID

object ConfigConverter {
private val DefaultH2SandboxJdbcUrl = "jdbc:h2:mem:sandbox;db_close_delay=-1"

def toSandboxOnXConfig(
sandboxConfig: SandboxConfig,
maybeLedgerId: Option[String],
ledgerName: LedgerName,
): Config[BridgeConfig] = {
val singleCombinedParticipant = ParticipantConfig(
mode = ParticipantRunMode.Combined,
Expand Down Expand Up @@ -75,7 +75,8 @@ object ConfigConverter {
mode = Mode.Run,
ledgerId = sandboxConfig.ledgerIdMode match {
case LedgerIdMode.Static(ledgerId) => ledgerId.unwrap
case LedgerIdMode.Dynamic => maybeLedgerId.getOrElse(UUID.randomUUID().toString)
case LedgerIdMode.Dynamic =>
maybeLedgerId.getOrElse(LedgerIdGenerator.generateRandomId(ledgerName).unwrap)
},
commandConfig = sandboxConfig.commandConfig,
submissionConfig = sandboxConfig.submissionConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,17 @@

package com.daml.platform.sandbox

import com.daml.ledger.resources.ResourceContext
import com.daml.cliopts.GlobalLogLevel
import com.daml.logging.ContextualizedLogger
import com.daml.logging.LoggingContext.newLoggingContext
import com.daml.platform.sandbox.config.SandboxConfig
import com.daml.ledger.resources.ResourceContext
import com.daml.resources.ProgramResource
import scala.util.chaining._

object SandboxMain {

private val logger = ContextualizedLogger.get(this.getClass)

def main(args: Array[String]): Unit =
new ProgramResource({
val config: SandboxConfig = Cli.parse(args).getOrElse(sys.exit(1))
config.logLevel.foreach(GlobalLogLevel.set("Sandbox"))

// Point users to non-deprecated ledgers
config.jdbcUrl.foreach(_ =>
newLoggingContext { implicit loggingContext =>
logger.info(
"Sandbox classic with persistence is deprecated. Use the Daml Driver for PostgreSQL if you need persistence."
)
}
)
SandboxServer.owner(Name, config)
}).run(ResourceContext.apply)

Cli
.parse(args)
.getOrElse(sys.exit(1))
.tap(_.logLevel.foreach(GlobalLogLevel.set("Sandbox")))
.pipe(SandboxServer.owner(Name, _))
.pipe(new ProgramResource(_).run(ResourceContext.apply))
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class SandboxServer(
.map(getLedgerId(_)(resourceContext, resourceManagementExecutionContext, materializer))
.getOrElse(Resource.successful(None))
genericConfig =
ConfigConverter.toSandboxOnXConfig(config, maybeLedgerId)
ConfigConverter.toSandboxOnXConfig(config, maybeLedgerId, DefaultName)
participantConfig <-
SandboxOnXRunner.validateCombinedParticipantMode(genericConfig)
(apiServer, writeService) <-
Expand Down

This file was deleted.

Loading

0 comments on commit 8d65aa3

Please sign in to comment.