daml/ledger-service
Stephen Compall 8ec103ea0b
speed up sync fetch by contract ID/key with postgres and faster in-memory filtering (#7993)
* mark some of dbbackend private

* fetchBy* functions for Queries

* shift in-memory filtering into the transaction stream

- removes irrelevant contracts from memory as soon as possible for fetch by
  contract ID and key in-memory

* push the three synchronous search varieties into new signatures

* replace the core findByContract* functions with DB-delegating versions

* remove the GADT equality and most of the explicit traversals

- compiles again, finally

* factoring

* ContractDao wrappers for fetchById and fetchByKey

* DB version of findByContractId

* DB version of findByContractKey

* Search is the split of ContractsService

* fix SQL for keys

* trade the typeclass for a sum type

- sealed instead of final because of the path dependency on ContractsService
  instance

* number conversion is done already in ContractDao

* make fetch-by-key tests depend on proper number conversion for SQL

* add changelog

CHANGELOG_BEGIN
- [JSON API] ``/v1/fetch`` now uses the Postgres database, if configured, to
  look up contracts by ID or key, except when querying a contract by ID without
  its corresponding template ID.  The fallback in-memory version of
  ``/v1/fetch`` is also now significantly more efficient for large datasets,
  though still linear.

  You may optionally re-create JSON API's database to take full advantage.
  See `issue #7993 <https://github.com/digital-asset/daml/pull/7993>`__.
CHANGELOG_END

* use search.search for search

- suggested by @cocreature; thanks

* add an index for contract key lookups

- suggested by @cocreature; thanks
2020-11-30 13:51:29 -05:00
..
cli-opts Move common jwt cli flags (#7811) 2020-10-26 17:53:37 +00:00
db-backend speed up sync fetch by contract ID/key with postgres and faster in-memory filtering (#7993) 2020-11-30 13:51:29 -05:00
http-json speed up sync fetch by contract ID/key with postgres and faster in-memory filtering (#7993) 2020-11-30 13:51:29 -05:00
http-json-perf Add tests for connection failures in the JSON API (#7751) 2020-10-20 18:59:11 +02:00
http-json-testing Upgrade akka and akka-http (#8048) 2020-11-25 10:13:51 +01:00
jwt add more scalac 2.12 warnings (#6798) 2020-07-21 08:18:01 -04:00
lf-value-json LF: Kill ValueStruct (#7457) 2020-09-22 13:37:59 +02:00
utils Bazel: Factor out logic around Protobuf JARs. [KVL-714] (#8084) 2020-11-27 08:34:53 +00:00