TODO
====

* Use the new Job plugin API

* Transfer jobs are currently not serialized in the registry -> they won't restart !

* Decide whether we should also duplicate the metadata from the local
  Orthanc server to the remote Orthanc server:
  https://groups.google.com/g/orthanc-users/c/YV_1HPRaPfo

* if only one large instance (600MB) to transfer and 4 workers, all 4 workers will request the
  instances to Orthanc and try to store it in cache:
  I0712 13:32:46.345502 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
  I0712 13:32:46.629497 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
  I0712 13:32:46.925776 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
  --- extra logs ---- E0712 13:32:52.562947 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
  --- extra logs ---- E0712 13:32:52.810866 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
  --- extra logs ---- E0712 13:32:53.120938 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
  --- extra logs ---- E0712 13:32:53.385318 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
  I0712 13:33:34.338833 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/32 (timeout: 60s)
  I0712 13:33:34.879165 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/30 (timeout: 60s)
  I0712 13:33:36.146970 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/33 (timeout: 60s)
  I0712 13:33:36.929801 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/31 (timeout: 60s)
  -> cache should handle a list of "instances being loaded" and have 3 workers wait for it to become available

  * add metrics:
    - cache size
    - commit duration (depending on size)
    - active push transfers
  
  * use multiple threads to commit (S3) 

  * TODO: Have a deep look at the gRPC patch to consume less HTTP threads and possibly improve bandwidth when there are a lot of concurrent jobs.
    Identified issues:
    - another HTTP port to open and secure (what about TLS termination ?  Nginx can probably handle it too)
    - what about authentication ?  It's out of the standard HTTP server which means we probably need to re-implement a specific authentication
      solution -> we can not re-use the authorization plugin as such
    - expected compilation hell on other platforms (Windows, macOS, Linux LSB ...) -> we should probably include it only in the orthancteam/orthanc Docker images.
    Reference: https://discourse.orthanc-server.org/t/initiative-for-enhancing-transfer-accelerator-plugin/5817/8

