sapling/lib/commitcloudsubscriber/Cargo.toml
Liubov Dmitrieva d865e06a0d commitcloudsubscriber: add log throttling rates and add tcp socket listener to receive simple commands
Summary:
Added logic to control logging rate: empty messages that comes to confirm the subscription is alive, also on error logging rate when we are offline, also when we are running in standby with no active subscriptions

Also, I made a simple cross platform API, so that hg can trigger restart subscriptions in 2 lines of code. It is simple request - response API on tcp socket and json.

If a human run `hg cloud join`, hg will add subscriber file to the directory scm daemon reads subscribers from and will send the restart command, same for any `hg cloud leave` run

Another advantage is that the client (hg) can very easy check if the scm daemon is alive or not. (In 2 lines of code, cross platform, without any pid logic or other platform specific ifs)

Another advantage is that we can use it to receive some stats from the scm daemon.

I decided do not go with any watching directory logic, because changes are really rare events, and it will be better if a client (hg)  will just notify the service to restart subscriptions when needed.

Also, I verified that hg and SCM Daemon use the same config options and logic related to detected home directory on different platforms and reading the token.

Reviewed By: markbt

Differential Revision: D8162237

fbshipit-source-id: 3cb48b90f5e065ce4dc7fdc7215c3ce6ad57fb9a
2018-05-30 08:15:17 -07:00

31 lines
935 B
TOML

[package]
name = "commitcloudsubscriber"
version = "0.1.0"
description = """ \
Cross platform client for subscribing to Commit Cloud eventsource (http server-sent events) \
The workflow is the following: \
* define 'subscription' as a unique [repo_name, workspace] pair \
* read set of 'subscribers', defined as [repo_name, workspace, repo_root] \
* runs a Commit Cloud eventsource listener in a separate thread for every 'subscription' \
(and a set of 'subscribers' (repo_roots)) \
* triggers `hg cloud sync` command on notifications in all 'subscribers' (repo_roots) \
for a given 'subscription' \
* the library also contains a module to find OAuth token, \
this logic should be in sync with `hg cloud auth` command. \
"""
[dependencies]
enum_primitive = "*"
eventsource = "*"
failure = "*"
lazy_static = "*"
log = "*"
num = "*"
serde = "*"
serde_derive = "*"
serde_json = "*"
reqwest = "*"
rust-ini = "*"
regex = "*"