daml/libs-scala
Samir Talwar 7f679b9896
resources: Customizable contexts. (#7678)
* resources: Move builders into //ledger/ledger-resources.

Keep the actual constructors in a trait, but instantiate it when working
with ledger code.

This allows us to later introduce an extra "context" type parameter to
ResourceOwner.

* resources-akka: Move the builders in to //ledger/ledger-resources.

* resources: Introduce an abstract `Context` parameter for owners.

This replaces the concrete `ExecutionContext`. While it _can_ be an
execution context, it really doesn't matter as long as we can get at one
somehow.

This is being introduced so we can wrap the context in a container,
either for type tagging or to include extra information.

Because our current context _is_ `ExecutionContext`, and an implicit is
provided to extract it, we can end up with two ways to get the same
value. We use shadowing to prevent this. This problem should go away in
the near future when a new context type is added.

CHANGELOG_BEGIN
- [Integration Kit] The `ResourceOwner` type is now parameterized by a
  `Context`, which is filled in by the corresponding `Context` class in
  the _ledger-resources_ dependency. This allows us to pass extra
  information through resource acquisition.
CHANGELOG_END

* ledger-resources: Move `ResourceOwner` here from `resources`.

* ledger-resources: Remove dependencies from outside //ledger.

* ledger-resource: Wrap the acquisition execution context in `Context`.

So we can add a logging context to it.

* resources: Pass the Context, not the ExecutionContext, to Resource.

* Avoid importing `HasExecutionContext`.

* ledger-resources: Publish to Maven Central.

* resources: Make the small changes suggested by @stefanobaghino-da.

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>

* ledger-resources: Pull out a trait for test resource contexts.

Saves a few lines of code.

* Restore some imports that were accidentally wildcarded.

* resources: Replace an `implicit def` with a couple of imports.

* participant-integration-api: Simplify the JdbcLedgerDaoBackend tests.

Try and use the right execution context where possible.

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 09:26:28 +00:00
..
auth-utils Use com.daml as root package (#5343) 2020-04-05 19:49:57 +02:00
build-info Use com.daml as root package (#5343) 2020-04-05 19:49:57 +02:00
concurrent add silent_annotations option to da_scala bazel functions (#7668) 2020-10-13 15:44:16 +00:00
contextualized-logging add silent_annotations option to da_scala bazel functions (#7668) 2020-10-13 15:44:16 +00:00
gatling-utils Write report summary in text format (#7407) 2020-09-16 09:31:54 -04:00
grpc-utils Use com.daml as root package (#5343) 2020-04-05 19:49:57 +02:00
ports fix flaky 'restart triggers after shutdown' test (#6926) 2020-08-04 08:15:08 -04:00
postgresql-testing resources: Customizable contexts. (#7678) 2020-10-20 09:26:28 +00:00
resources resources: Customizable contexts. (#7678) 2020-10-20 09:26:28 +00:00
resources-akka resources: Customizable contexts. (#7678) 2020-10-20 09:26:28 +00:00
scala-utils Introduce //libs-scala/scala-utils (#6935) 2020-07-30 13:51:07 -04:00
scalatest-utils set scalac -Xsource:2.13 -Ypartial-unification globally (#6469) 2020-06-24 16:51:24 -04:00
timer-utils participant-integration-api: Never use a delay of zero. (#7175) 2020-08-19 10:43:31 +00:00