Commit Graph

6 Commits

Author SHA1 Message Date
Kostia Balytskyi
8a273fbd9d mononoke_api: use TestMononokeMegarepoConfigs depending on cli
Summary:
This change makes it so that our binaries do not instantiate a real configo
client in integration test setup.

Reviewed By: ahornby

Differential Revision: D28026790

fbshipit-source-id: 0fb9ce66a1324e845f4b8a80d4479263ec6e4ee1
2021-04-27 06:37:34 -07:00
Alex Hornby
bc85aade21 rust: update to zstd to 0.7.0+zstd.1.4.9
Summary:
Update the zstd crates.

This also patches async-compression crate to point at my fork until upstream PR https://github.com/Nemo157/async-compression/pull/117 to update to zstd 1.4.9 can land.

Reviewed By: jsgf, dtolnay

Differential Revision: D27942174

fbshipit-source-id: 26e604d71417e6910a02ec27142c3a16ea516c2b
2021-04-22 14:34:06 -07:00
Alex Hornby
45f521ddde mononoke: enable default patch.crates-io for internal Cargo.tomls
Reviewed By: quark-zju

Differential Revision: D27915811

fbshipit-source-id: 3f830def66c1c5f0569925c42cc8335ee585e0e7
2021-04-22 10:59:42 -07:00
Kostia Balytskyi
d48c87a95e megarepo: introduce write side of MononokeMegarepoConfigs
Summary:
`MononokeMegarepoConfig` is going to be a single point of access to
config storage system - provide both writes and reads. It is also a trait, to
allow for unit-test implementations later.

This diff introduces a trait, as well as implements the write side of the
configerator-based implementor. The read side/oss impl/test impl
is left `unimplemented`. Read side and test impl will be implemented in the future.

Things I had to consider while implementing this:
- I wanted to store each version of `SyncTargetConfig` in an individual
  `.cconf` in configerator
- at the same time, I did not want all of them to live in the same dir, to
  avoid having dirs with thousands of files in it
- dir sharding uses sha1 of the target repo + target bookmark + version name,
  then separates it into a dir name and a file name, like git does
- this means that these `.cconf` files are not "human-addressable" in the
  configerator repo
- to help this, each new config creation also creates an entry in one of the
  "index" files: human-readable maps from target + version name to a
  corresponding `.cconf`
- using a single index file is also impractical, so these are separated by
  ascification of the repo_id + bookmark name

Note: this design means that there's no automatic way to fetch the list of all
targets in use. This can be bypassed by maintaining an extra index layer, whihc
will list all the targets. I don't think this is very important atm.

Reviewed By: StanislavGlebik

Differential Revision: D27795663

fbshipit-source-id: 4d824ee4320c8be5187915b23e9c9d261c198fe1
2021-04-22 02:13:19 -07:00
Kostia Balytskyi
81675b2d5b megarepo: introduce megarepo_error and make configo_client use it
Summary:
We want to distinguish user vs system errors in `configo_client` and its users
(`mononoke_config` for instance). The reason is to allow `scs_server`
distinguish the two types of errors. Normally user errors would only ever be
instantiated fairly "shallowly" in the `scs_server` itself, but `configo_client`
is a transactional client (by this I mean that it calls user-provided transformation functions on fetched data), so we need to allow for a user error to originate from these updater functions.

Reviewed By: StanislavGlebik

Differential Revision: D27880928

fbshipit-source-id: e00a5580a339fdabc4b858235da9cd7e9fc7a376
2021-04-21 05:02:00 -07:00
Kostia Balytskyi
815b5ad04a megarepo_api: introduce a basic configo client
Summary:
This is not used on its on, but in subsequent diffs I will add a use-case, by
the megarepo configs crate.

When built in non-fbcode mode, this crate does not export anything. I chose this approach as opposed to the approach of exporting no-op stubs to force the clients to pay attention and implement gating their side too. This seems reasonable for a rather generic configo client.

Reviewed By: StanislavGlebik

Differential Revision: D27790753

fbshipit-source-id: d6dcec884ed7aa88abe5796ef0e58be8525893e2
2021-04-19 08:34:12 -07:00