Commit Graph

194 Commits

Author SHA1 Message Date
Robert Autenrieth
7e448d810c
Always use the latest ledger config (#5669)
CHANGELOG_BEGIN
- [Sandbox] The ledger API server will now always use the most recent ledger configuration.
  Until a ledger configuration is read from the ledger, command submissions will fail with the UNAVAILABLE error.
CHANGELOG_END

In kvutils, the first ledger configuration change needs
to have a generation one higher than the one returned
by getLedgerInitialConditions().

Remove initial config writing from sandbox as it's now written by the ledger API server
2020-05-06 12:12:23 +02:00
Moritz Kiefer
0e5aa4bebf
Remove -o config from PostgresAround (#5707)
We already specify those values in the config file.

changelog_begin
changelog_end
2020-04-23 16:08:37 +00:00
Samir Talwar
16a0902c3a
resources: Don't time out ProgramResource on startup. (#5564)
* resources: Rename `tearDownDuration` to `tearDownTimeout`.

* resources: Don't time out `ProgramResource` on startup.

Let it go for as long as it needs to.

Sometimes Sandbox takes a while to start, especially if you're
preloading large DARs. We should not try and predict how long it will
take.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-15 13:35:02 +00:00
Leonid Shlyapnikov
b1c87e9f12
Fixing scaladoc (#5506)
changelog_begin
changelog_end
2020-04-09 06:01:18 +00:00
Leonid Shlyapnikov
29e1931f17
Add --port-file command line option to JSON API (#5454)
* Adding `--port-file` support

* ``--port-file`` support

* Updating docs

changelog_begin

[JSON API] Add support for ``--port-file`` command line option.
``--http-port 0 --port-file ./json-api.port`` will pick up a free port
and write it into ``./json-api.port` file.

changelog_end

* reformatting

* Usage grammar

* use bimap

* Adding `PortFiles` utility for creating and deleting port files on JVM exit

* Adding scaladoc explaining that the port file should be deleted on

JVM termination.

* Updating usage and docs to reflect that the file must be unique and

will be deleted on graceful shutdown

* Relying on `java.nio.file.FileAlreadyExistsException` to determine the

case when failed due to the nonunique file name.

* toString instead of Exception.getMessage

java.nio exception's getMessage can be just a file name, need the class
name to capture the error context.

* updatePortFile -> createPortFile

* write to file instead of write into file
2020-04-08 18:48:11 +00:00
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02:00
Gerolf Seitz
329320bad9
Organize maven coordinates (#5272)
* Use com.daml as groupId for all artifacts

CHANGELOG_BEGIN
[SDK] Changed the groupId for Maven artifacts to ``com.daml``.
CHANGELOG_END

* Add 2 additional maven related checks to the release binary

1. Check that all maven upload artifacts use com.daml as the groupId
2. Check that all maven upload artifacts have a unique artifactId

* Address @cocreature's comments in https://github.com/digital-asset/daml/pull/5272#pullrequestreview-385026181
2020-04-01 11:41:18 +02:00
Samir Talwar
52dbcf5d95
postgresql-testing: "Lock" ports when starting PostgreSQL. (#5310)
* http-json: Ask for a free port by specifying port 0.

This will avoid race conditions.

* bindings-akka-testing: Delete RandomPorts; it's unused.

* ports: Fix the Bazel test glob.

* ports: Move FreePort to postgresql-testing and add a test case.

* postgresql-testing: Make `FreePort.find()` return a `Port`.

* postgresql-testing: Lock free ports until the server starts.

This uses a `FileLock`, which should work well on all our
supported operating systems as long as everyone agrees to use it.

CHANGELOG_BEGIN
CHANGELOG_END

* postgresql-testing: Try to find a free port 10 times, then give up.

* postgresql-testing: Use a shared directory for the port lock.

* postgresql-testing: Try an alternative way of getting `%LOCALAPPDATA%`.
2020-03-31 17:13:02 +00:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Samir Talwar
1e13b8679e
postgresql-testing: On failure, logs are no longer an Option. (#5190)
`logs` used to be an `Option[Seq[String]]`. They were changed to
`Seq[String]` with a default of `Seq.empty`, but the code to print them
still assumed an `Option`, which means they were printing as
"ArrayBuffer(line 1, line 2, line 3)" instead of, well, nicely.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-26 08:09:24 +00:00
Stefano Baghino
181df8f3ab
Act on Option2Iterable wart (#5154)
Some Option2Iterable ignore annotations are not needed, others were needed for unused methods.

In a few occasions we were ignoring the warning for the very purpose for which is was there,
i.e. avoiding an implicit conversion. I'm all for not verifying this rule if we agree we
don't need it.

For ProcessFailedException it was a bit gratuitous, I changed the way in which the exception
message is built.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-24 11:25:05 +00:00
Stefano Baghino
1f0534ea4f
Spin-off BuildInfo into its own (micro-)library (#5004)
* Spin-off BuildInfo into its own (micro-)library

CHANGELOG_BEGIN
CHANGELOG_END

* Fix dependencies

* Remove unused dependency
2020-03-16 09:04:00 +01:00
mergify[bot]
e785bb7402
Sandbox: Re-use actor systems between the StandaloneApiServer and StandaloneIndexerServer. (#4827)
* sandbox: Re-use the root actor system in the StandaloneIndexerServer.

* kvutils/app: Don't use the ActorSystem execution context randomly.

Instead, make `Runner` a proper ResourceOwner, with an `acquire` method.

* sandbox: Re-use the root actor system in the StandaloneApiServer.

CHANGELOG_BEGIN
CHANGELOG_END

* resources: Remove the now-unused `ResourceOwner.sequence` functions.

They weren't well-thought-out anyway; they acquire resources
sequentially, rather than in parallel.
2020-03-05 14:50:18 +00:00
Samir Talwar
85998f8f06
Sandbox-Next: Add the ResetService. (#4802)
* sandbox-next: Make the Runner a real ResourceOwner.

* sandbox: Don't construct the ResetService twice.

* sandbox: Inline and simplify methods in StandaloneApiServer.

* resources: Define a `ResettableResource`, which can be `reset()`.

`reset()` releases the resource, performs an optional reset operation,
and then re-acquires it, binding it to the same variable.

* resources: Pass the resource value into the reset operation.

* sandbox: Fix warnings in `TestCommands`.

* sandbox-next: Add the ResetService.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Make sure the SandboxResetService resets asynchronously.

It was being too clever and negating its own asynchronous behavior.

* sandbox-next: Forbid no seeding.

This double negative is really hard to phrase well.

* sandbox-next: Implement ResetService for a persistent ledger.

* sandbox: Delete the comment heading StandaloneIndexerServer.

It's no longer meaningful.

* sandbox-next: No need to wrap the SandboxResetService in an owner.

* sandbox-next: Bump the ResetService test timeouts.

It looks like it's definitely slower than on Sandbox Classic™. Gonna
look into this as part of future work.

* Revert to previous asynchronous reset behavior

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-04 14:40:35 +00:00
Samir Talwar
a73b7459a7
resources: Resource.unit, as an alias for Resource.successful(()). (#4786)
* resources: `Resource.unit`, as an alias for `Resource.successful(())`.

CHANGELOG_BEGIN
CHANGELOG_END

* resources: Add `ResourceOwner.unit`.
2020-03-03 16:47:54 +00:00
Samir Talwar
a99156252d
libs-scala/ports: Wrap socket ports in a type, Port. (#4784)
* libs-scala/ports: Wrap socket ports in a type, `Port`.

* sandbox: Use `Port` for the API server port, and propagate.

CHANGELOG_BEGIN
CHANGELOG_END

* extractor: Use `Port` for the server port.

* ports: Make Port a compile-time class only.

* ports: Allow port 0; it can be specified by a user.

* ports: Publish to Maven Central.
2020-03-03 08:59:15 +00:00
Samir Talwar
9bdfbb0534
Avoid opening a server to the world when finding a free port. (#4683)
* Avoid opening a server to the world when finding a free port.

This is very annoying on macOS because we get a focus-stealing popup for
a split second, asking for permission to allow the server through the
firewall. The popup pretty much always disappears before it can even be
read, when the server is closed.

This is almost certainly not an attack vector, because:
  - we only do this in tests,
  - the server is open for only a few milliseconds,
  - nothing is served,
  - and finding the port is tricky, because it's effectively random.

Nevertheless, it's very annoying.

CHANGELOG_BEGIN
CHANGELOG_END

* Extract a Bazel package for finding free ports.

We seem to do it in 4 different places, which I think is enough to
remove the duplication.
2020-02-25 13:09:28 +00:00
fabiotudone-da
0fd7bcaadc
Document and comment Resource and ResourceOwner. (#4651)
* Document and comment `Resource` and `ResourceOwner`.

* Apply @SamirTalwar-DA's suggested changes

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-21 14:56:00 +01:00
Samir Talwar
2ec710b0e3
Sandbox & kvutils: Use the existing ledger ID if no ledger ID is specified. (#4607)
* sandbox: If the ledger ID isn't provided, use the one in the database.

Previously, we would fail if working against an existing ledger, and not
explicitly providing the ledger ID. This was the case even if the ledger
ID was randomly generated initially.

CHANGELOG_BEGIN
- [Sandbox] If no ledger ID is provided when running against an existing
  ledger, use the existing ID. Previously, Sandbox would fail to start.
CHANGELOG_END

* sandbox: The ReadOnlySqlLedger should always receive a ledger ID.

It's read-only; it can't create one.

* sandbox: Stop using `equal` in SqlLedgerSpec.

* sandbox: Test that the ledger ID is as specified in SqlLedgerSpec.

* sandbox: Let the top-level runner handle a ledger ID mismatch.

And clean up the log text.

* sandbox: Initialize the ledger properly when the ID is dynamic.

* sandbox: Use `Vector`, not `List`, for SqlLedger initialization.

Append with Vector, good. List, bad.

* ledger-api-common: Make `LedgerApiMode.Dynamic` an object.

And add Java-style static factory methods.

* kvutils/app | ledger-on-{memory,sql}: Make `ledgerId` optional.

It should be generated or retrieved from the persistence layer by the
ledger itself.

* kvutils: Make the ledger ID optional in the tests.

* ledger-on-sql: Store the ledger ID, and reject conflicting IDs.

* ledger-on-sql: Make more things final.

* ledger-on-sql: Document the `ledger_meta.table_key` column better.

* sandbox: Don't hardcode the number of packages in the test DAR.

It changes.

* ledger-on-sql: Merge the `head` resource owner with the `dispatcher`.

* sandbox: Use backticks to simplify pattern match in ReadOnlySqlLedger.

* ledger-on-sql: Extract methods in `owner`.
2020-02-20 10:35:16 +00:00
Samir Talwar
a589f4af0b
sandbox: Move more resource acquisition into the owner. (#4501)
* sandbox: Move more resource acquisition into the `owner`.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox: Reimplement SandboxClientResource as a resources.Resource.

* codegen: Use resources in TestUtil.

* sandbox: Manage PostgreSQL in tests with ResourceOwners.
2020-02-14 13:52:45 +00:00
Samir Talwar
6fd402f634
Sandbox: Preliminary work to rebuild Sandbox on top of kvutils. (#4422)
* resources: Allow for startup exceptions without no stack trace.

* sandbox: Remove dependency duplication in the BUILD file.

* ledger-on-(memory|sql): Extract `Main` into its own file tree.

This is so we can remove the dependency on kvutils/app from the library.

logback.xml goes with it.

* sandbox: Implement "Sandbox Next" on top of ledger-on-sql.

CHANGELOG_BEGIN
- [Sandbox] Preliminary work to rebuild Sandbox on top of the DAML
  Ledger Integration Kit. Currently not exposed through the CLI.
CHANGELOG_END

* ledger-on-sql: Publish to Maven Central.

* sandbox: If an unknown database is passed to Sandbox Next, handle it.

* resources: Catch errors in owner construction or acquisition.

Sometimes we're not in a future yet.

* resources: Don't run ProgramResource error handling inside the EC.

Otherwise we end up in deadlock which is only broken by
`awaitTermination` timing out.
2020-02-06 17:34:17 +00:00
Samir Talwar
e6f890282e
ledger-on-sql: Run the indexer on PostgreSQL when possible. (#4398)
* ledger-on-sql: Add a prefix of "ledger_" to the Flyway migrations table.

And while we're at it, make this a constant in the code and use Flyway
placeholders to substitute it in.

We don't have any users right now, so changing the migrations should be
fine.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-sql: Run the indexer on PostgreSQL when possible.

Specifically, when running the PostgreSQL conformance tests.

It will also work when running it as a binary, but you need to specify
both the `--server-jdbc-url` and `--jdbc-url` switches. This is to keep
kvutils/app simple.

* ledger-on-sql: Make `ExtraConfig` final.

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

* resources: Revert `ResourceOwner.failed` to `ResourceOwner[Nothing]`.

Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-02-05 11:12:46 +00:00
Samir Talwar
1df292cece
kvutils|ledger: Don't use Scala's global execution context. (#4374)
* kvutils|ledger: Don't use Scala's global execution context.

I have just discovered that Scala's global execution context uses daemon
threads, which means they don't stick around past the end of the `main`
function. This is bad when application startup fails and we end up with
no other threads; the application terminates before it has a chance to
print the error message, which is very unhelpful.

We resolve this by creating a cached thread pool in the
`ProgramResource` class, specifically used for acquisition and release
of resources.

To do this, we need to pass the execution context through to the
resource constructors, which makes usage a little more verbose, because
now we can't use lambda functions (which can't take implicit arguments
such as the `executionContext`).

CHANGELOG_BEGIN
CHANGELOG_END

* kvutils-app|reference-v2: Sort `Runner` and `ReferenceServer` methods.
2020-02-05 09:15:29 +00:00
Stefano Baghino
9d3a0f8a3b
Resource refactorings (#4382)
* Refactor ResourceOwner convenience methods

CHANGELOG_BEGIN
CHANGELOG_END

* Add the unreleasable Resource constructor

* Refactor reference server, reduce nesting

* Refactor kvutils runner, reduce nesting

* Refactor usages of ResourceOwner.fromFuture as Resource.unreleasable

* Replace vary method with covariance annotation in Resource

* Replace vary method with covariance annotation in ResourceOwner

* Address https://github.com/digital-asset/daml/pull/4382#discussion_r374758832
2020-02-04 17:20:24 +00:00
Samir Talwar
4d7e62de1f
kvutils|ledger|sandbox: Replace uses of scala.App with def main. (#4366)
`App` is fairly problematic. It depends on `DelayedInit`, which is
deprecated because it has some surprising behavior.

Best to avoid it for anything more than a simple demo application.

Details: https://github.com/scala/bug/issues/4330

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-04 13:38:36 +00:00
Samir Talwar
e203fdea90
resources: Pull out the shutdown hook logic into ProgramResource. (#4356)
It's not trivial, so it's almost certainly less error-prone to just
define it once.

CHANGELOG_BEGIN
CHANGELOG_END
2020-02-04 09:32:35 +00:00
Samir Talwar
791fad5309
kvutils: Test that the ledger can be restarted and will resume where it left off. (#4321)
* kvutils: Use `ResourceOwner#use` to simplify tests.

* kvutils: Merge in `RestartSpec` from ledger-on-sql.

CHANGELOG_BEGIN
- [KVUtils] Added a test case to the participant state tests to ensure
  your ledger state is resumable upon restart.
CHANGELOG_END

* ledger-on-posix-filesystem: Extract paths into their own class.

* ledger-on-posix-filesystem: Seed the dispatcher with the correct head.

* kvutils: In participant state tests, be clear about different strings.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-31 16:26:36 +00:00
Samir Talwar
2ad0f98db0
resources: Throw upon acquiring the implicit ExecutionContext. (#4320)
* resources: Throw upon acquiring the implicit ExecutionContext.

If we try and release an executor service which is itself being used to
power the releasing, we end up in a deadlock—the executor can't shut
down, and therefore `awaitTermination` never completes.

Fixing this is hard, but banning it is easy.

CHANGELOG_BEGIN
CHANGELOG_END

* resources: Explain a little more how the ExecutionContext check works.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-31 12:51:53 +00:00
Samir Talwar
eaf17cae73
ledger-on-posix-filesystem: Lock the entire ledger with a file lock. (#4249)
* ledger-on-posix-filesystem: Run `scalafmt`.

* ledger-on-posix-filesystem: Just use file channel locks. Seriously.

* ledger-on-posix-filesystem: Rename `FileSystemLock#run` to `apply`.

* ledger-on-posix-filesystem: Conformance tests now run quickly.

So we can stop constraining the number of concurrent test runs.

* ledger-on-posix-filesystem: Lock the entire ledger with a file lock.

This ensures we can't have two separate ledger servers running against
the same directory.

This is mostly an experiment to better understand how to do this on an
SQL ledger for #4039.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-posix-filesystem: Run `scalafmt`.

* ledger-on-posix-filesystem: Use `Resource#use` in `FileSystemLock`.

* resources: Move `Resource#use` to `ResourceOwner#use`.

Makes more sense for the same object to govern both `acquire()` and
`release()`.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-30 14:35:38 +00:00
Samir Talwar
fb58dc8756
ledger-on-sql: Make sure the ledger picks up where it left off. (#4266)
* resources: Make it easy to use a resource and then release it.

* ledger-on-sql: Move database transaction methods to `Database`.

* ledger-on-sql: Make sure the ledger picks up where it left off.

This means seeding the dispatcher with the correct head, rather than
starting at 1 every time.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-sql: Move `Index` and `StartIndex` to the package object.

They're used everywhere.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-30 10:16:32 +00:00
Samir Talwar
c81cc2ab2a ledger-on-sql: Migrate tables using Flyway. (#4232)
* ledger-on-sql: Pull out a superclass for the various integration tests.

* ledger-on-sql: Use Flyway to migrate tables in an idempotent manner.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-sql: Make it easy to run it with Bazel for experimentation.

* ledger-on-sql: Test that migrations will never change in the future.

* ledger-on-sql: Add a prefix of "ledger_" to the tables.

This is so we don't accidentally conflict with the index when the
schemas are shared.

I am letting myself modify the migrations because the existing
migrations haven't been merged into `master` yet.

* ledger-on-sql: Explain why we change the pool size after migration.

* ledger-api-test-tool: Tests now specify a timeout scale, not a timeout.

Makes it easier to change the default timeout in one place.

* ledger-api-test-tool: Increase timeouts on slow tests.

These tests produce a lot of volume and can make CI flaky.

* ledger-on-sql: Only tear down PostgreSQL in tests.

For other databases, we just create a new file for each test case.

* ledger-on-sql: Reduce the log output in tests.

* ledger-on-sql: Use a separate connection pool for Flyway when possible.

Apparently `setMaximumPoolSize` doesn't really have the desired effect
after the connection pool has already been used. The new test case will
be flaky if we process more than one commit in parallel.

For SQLite, it seems to be OK.

* ledger-on-sql: Use a separate connection pool for Flyway with SQLite.

Except in memory.

* ledger-on-sql: Use a separate PostgreSQL database for each test.

Because performance, innit. Don't have to tear them down.

* ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects.

* ledger-on-sql: Go into even more detail about pool size hijinks.

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 16:16:23 +00:00
Stefano Baghino
243746d465 Add logging context information to ledger services (#4205)
* Add logging context information to ledger services

Rolls back that AllowedType implicit, which made the logging context
less usable and didn't provide that much of an advantage. Replaced with
helpers where it makes sense that take care of turning the value safely
into a string.

Closes #3699

CHANGELOG_BEGIN
CHANGELOG_END

* Remove unused import

* Address https://github.com/digital-asset/daml/pull/4205#discussion_r370704306
2020-01-24 18:28:08 +00:00
Samir Talwar
f3f7def5d2
postgresql-testing: Extract PostgresAround from the Sandbox t… (#4197)
* postgresql-testing: Extract `PostgresAround` from the Sandbox tests.

CHANGELOG_BEGIN
CHANGELOG_END

* postgresql-testing: Split into several files.

* postgresql-testing: Pull out the host and database names into variables.

* postgresql-testing: Don't publish to Maven.

I have no idea why the build wasn't failing before.

* postgresql-testing: Assimilate the `@postgresql_dev_env` dependency.
2020-01-24 12:48:36 +01:00
Samir Talwar
e13f9a7edd
kvutils: Use resources in KeyValueParticipantState, not AutoClo… (#4177)
* kvutils: Use resources in KeyValueParticipantState, not AutoCloseable.

CHANGELOG_BEGIN
- [kvutils] The simplified API now uses ``com.digitalasset.resources``
  to manage acquiring and releasing resources instead of ``Closeable``.
CHANGELOG_END

* ledger-on-posix-filesystem: Remove dead code due to a refactoring fail.
2020-01-23 16:59:01 +01:00
Stefano Baghino
54abbf34ce
Add parties to logging context of active contracts service (#4175)
CHANGELOG_BEGIN
CHANGELOG_END
2020-01-23 10:47:16 +01:00
Samir Talwar
eeaa2edc91
ledger-on-posix-filesystem: Fix the tests on CI. (#4166)
* libs-scala: Make sure `RetryStrategy` works if `attempts.isEmpty`.

* ledger-on-posix-filesystem: Only retry on expected lock errors.

CHANGELOG_BEGIN
CHANGELOG_END

* ledger-on-posix-filesystem: Only create the lock attempt directory once.

Soooo much faster.

* ledger-on-posix-filesystem: Don't run the unit tests on Windows.
2020-01-22 18:02:23 +01:00
Samir Talwar
e2a5b26475
contextualized-logging: Move to its own Bazel package. (#4138)
I want to use this in _ledger/ledger-on-sql_, which doesn't depend
directly on Sandbox.

CHANGELOG_BEGIN
CHANGELOG_END
2020-01-21 14:25:06 +01:00
Stefano Baghino
1ad7d6c24c
Replace NamedLoggerFactory (#4097)
* Replace NamedLoggerFactory

CHANGELOG_BEGIN
CHANGELOG_END

* Recover change lost in rebase

* Address https://github.com/digital-asset/daml/pull/4045#discussion_r366883577

* Address https://github.com/digital-asset/daml/pull/4045#discussion_r366885112

* Address two open review comments

Address https://github.com/digital-asset/daml/pull/4045#discussion_r366885448
Address https://github.com/digital-asset/daml/pull/4045#discussion_r366885981

* Address outstanding compilation errors

* Replace mocking with in-memory log collector

* Address https://github.com/digital-asset/daml/pull/4097#pullrequestreview-344639319

* Address https://github.com/digital-asset/daml/pull/4045#discussion_r366886250

The generation of code to have logging in the services has been replaced
by helpers classes. This will allow to enrich the context received at
construction by the service implementations.

* Use ContextualizedLogger for TrackerMap

* Remove deleted logging packages from artifacts.yaml

* Remove remaining deleted artifact from artifacts.yaml

* Address https://github.com/digital-asset/daml/pull/4097#discussion_r368640231

* Address https://github.com/digital-asset/daml/pull/4097#discussion_r368648027

* Address https://github.com/digital-asset/daml/pull/4097#discussion_r368652178

* Address https://github.com/digital-asset/daml/pull/4097#discussion_r368654996

* Annotate type of references to logErrorOnCall

* Address https://github.com/digital-asset/daml/pull/4097#discussion_r368869575
2020-01-21 10:57:28 +01:00
Samir Talwar
b96e54f640 libs-scala/resources: Move Resource and friends to their own package. (#4066)
* libs-scala/resources: Move `Resource` and friends to their own package.

CHANGELOG_BEGIN
- [Ledger API Server] Publish the resource management code as a library
  under ``com.digitalasset:resources``.
CHANGELOG_END

* libs-scala/resources: Add to the artifacts list.

* libs-scala/resources: Factor out the test helpers into test/lib.

* libs-scala/resources-akka: Make the Akka resources an optional dep.
2020-01-16 14:13:18 +00:00
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Stefano Baghino
7020ed3b15
Moves CommandCompletionIT to Ledger API Test Tool (#3901)
* Moves CommandCompletionIT to Ledger API Test Tool

Closes #2841

Also refactors test observers into a single API and unifies the existing implementations of the DirectExecutionContext

* Allow explicit offsets to get checkpoints

* Raise checkpoint test timeout

* Consolidate checkpoint tests in a single test case

* Fix compilation issues

* Exclude command submission/completion tests for rev-v2

* Drop test not relevant for Ledger API implementations

* Fix compilation errors
2019-12-20 15:55:23 +01:00
Stefano Baghino
5254520b80 Spin off TokenHolder into a new library (#3741)
* Spin off TokenHolder into a new library

Avoids having weird dependencies between different packages, makes TokenHolder available on Maven

* Fix auth-utils path
2019-12-05 12:31:14 +00:00
Samir Talwar
1bd2ec5b1a grpc-utils: Simpler extractors. (#3594)
* grpc-utils: Simpler GrpcStatus extractors when you know the code.

And don't care about the description.

* grpc-utils: Simpler GrpcException extractors when you know the code.

And don't care about the description.

* Apply suggestions from code review

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

* Add `new` to `SpecificGrpc{Exception,Status}` constructor calls.

Also, don't blindly apply GitHub suggestions.
2019-11-22 21:09:17 +00:00
Stefano Baghino
c51ecd3c58
Extractor with authentication (#3514)
* Make Extractor work against Ledger API servers protected by authentication

* Update changelog

* Address https://github.com/digital-asset/daml/pull/3514#pullrequestreview-318811500

- https://github.com/digital-asset/daml/pull/3514#discussion_r347753205
- https://github.com/digital-asset/daml/pull/3514#discussion_r347753629
- https://github.com/digital-asset/daml/pull/3514#discussion_r347754462

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347755484

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347752424

* Address https://github.com/digital-asset/daml/pull/3514#discussion_r347756328

* Fix docs

* Fix artifacts.yaml
2019-11-19 17:12:25 +01:00