feat: stdio protocol between warmup program and rustic (#1782)#524
Open
philipmw wants to merge 1 commit into
Open
feat: stdio protocol between warmup program and rustic (#1782)#524philipmw wants to merge 1 commit into
philipmw wants to merge 1 commit into
Conversation
[JSON Lines](https://jsonlines.org). Each line must be a single JSON object. The object must contain at least a `type` field that identifies the message. ```json {"type":"pack-progress","warm":42} ``` A `pack-progress` message tells *rustic* how many of the packs in the current command invocation are expected to be warm now. | Field | Type | Meaning | |-------|---------|---------| | `type` | string | Must be exactly `"pack-progress"`. | | `warm` | integer | Number of packs from this invocation expected to be warm. | *rustic* advances its shared progress bar using these updates. `warm` is **monotonically non-decreasing** within a single invocation. If your program reports a lower value than a previous report, the lower value is ignored. If your command exits successfully but never emits a `pack-progress` message, *rustic* still counts the whole invocation as complete. If it reports some progress but the final `warm` is less than the number of packs in the invocation, *rustic* counts the remaining packs as done when the command exits. So the protocol is strictly an enhancement: emitting it gives users accurate progress; omitting it preserves the pre-protocol behavior of jumping from 0% to 100%. *rustic* now captures and parses warmup program's stdout. This is a change from older versions, where the warm-up command's stdout was inherited and printed directly to the terminal. Any stdout line that is not valid JSON is logged by *rustic* at info level, prefixed with `[warmup]`, so that it is still available for debugging. Empty lines are ignored. I plan to update rustic's documentation with this, once this change is accepted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSON Lines. Each line must be a single JSON object. The object must contain at least a
typefield that identifies the message.{"type":"pack-progress","warm":42}A
pack-progressmessage tells rustic how many of the packs in the current command invocation are expected to be warm now.type"pack-progress".warmrustic advances its shared progress bar using these updates.
warmis monotonically non-decreasing within a single invocation. If your program reports a lower value than a previous report, the lower value is ignored.If your command exits successfully but never emits a
pack-progressmessage, rustic still counts the whole invocation as complete. If it reports some progress but the finalwarmis less than the number of packs in the invocation, rustic counts the remaining packs as done when the command exits.So the protocol is strictly an enhancement: emitting it gives users accurate progress; omitting it preserves the pre-protocol behavior of jumping from 0% to 100%.
rustic now captures and parses warmup program's stdout. This is a change from older versions, where the warm-up command's stdout was inherited and printed directly to the terminal.
Any stdout line that is not valid JSON is logged by rustic at info level, prefixed with
[warmup], so that it is still available for debugging. Empty lines are ignored.I plan to update rustic's documentation with this, once this change is accepted.