Adding the functionality to be able to read local, packaged data for a collection. This allows us to provide configurations without being able to connect to the internet on a device, or on first start-up, where the sync is not finished yet.
This PR also adds two commands to the cargo remote-settings CLI, so developers can work with and integrate collections more seamlessly.
dump-sync
This command checks the local components/remote_settings/dumps/{bucket}/{collection_name}.json files and updates them with the latest remote copy if they are outdated.
The command scans the components/remote_settings/dumps folder, and goes through each bucket (represented via a folder-name), and each {collection_name}.json. It checks the timestamp of the collection and compares it to the one from the changes endpoint.
cargo remote-settings dump-sync --create-pr will create a local branch and push it to the repo.
cargo remote-settings dump-sync --dry-run is to test a possible run, without writing the results to the file(s).
> cargo remote-settings dump-sync --dry-run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.30s
Running `target/debug/examples-remote-settings-cli dump-sync --dry-run`
Collection main/search-telemetry-v2 is up to date
Dry run summary:
- Would update 0 collections
- 1 collections already up to date
- 0 collections not found on remote
Or without --dry-run:
> cargo remote-settings dump-sync
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/examples-remote-settings-cli dump-sync`
Collection main/search-telemetry-v2 is up to date
Execution summary:
Collections already up to date:
- main/search-telemetry-v2
This will download a copy of a single collection from remote, into the following local folder: components/remote_settings/dumps/{bucket}/{collection_name}.json.
Get a copy of a single collection locally:
> cargo remote-settings dump-get --bucket main --collection-name search-config-v2
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.67s
[00:00:00] ██████████████████████████████ Downloaded search-config-v2
Successfully downloaded collection to ./components/remote_settings/dumps/main/search-config-v2.json
Adding the functionality to be able to read local, packaged data for a
collection
. This allows us to provide configurations without being able to connect to the internet on a device, or on first start-up, where the sync is not finished yet.This PR also adds two commands to the cargo remote-settings CLI, so developers can work with and integrate
collections
more seamlessly.dump-sync
This command checks the local
components/remote_settings/dumps/{bucket}/{collection_name}.json
files and updates them with the latest remote copy if they are outdated.The command scans the
components/remote_settings/dumps
folder, and goes through eachbucket
(represented via a folder-name), and each{collection_name}.json
. It checks thetimestamp
of the collection and compares it to the one from thechanges
endpoint.cargo remote-settings dump-sync --create-pr
will create a local branch and push it to the repo.cargo remote-settings dump-sync --dry-run
is to test a possible run, without writing the results to the file(s).Or without
--dry-run
:dump-get --bucket BUCKETNAME --collection-name COLLECTION
.This will download a copy of a single collection from remote, into the following local folder:
components/remote_settings/dumps/{bucket}/{collection_name}.json
.Get a copy of a single collection locally: