Skip to content

util/io: Add the ByteSource trait - #882

Merged
chrysh merged 1 commit into
OpenPRoT:ocp-streaming-recoveryfrom
9elements:ocp-streaming-agent-1
Dec 1, 2026
Merged

chrysh merged 1 commit into
OpenPRoT:ocp-streaming-recoveryfrom
9elements:ocp-streaming-agent-1

Conversation

@chrysh

@chrysh chrysh commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

The OCP Recovery Agent, which later PRs add, reads each recovery image
at any offset through &self. PayloadSource in
services/orchestrator/capabilities offers len and read_at through
&self, but using it makes the agent crate depend on the orchestrator.
Upstream ocp-global-demo moves the trait to util/io as ByteSource.

This PR adds util/io/byte_source.rs with the code of the file on
ocp-global-demo and new doc comments. The orchestrator on
ocp-streaming-recovery reads its images through PayloadSource, and
this PR changes no line of the orchestrator.

I can not cherry-pick it from the demo-wip branch, because the commit that adds those lines also touches/adds files I don't need for the OCP SFR.

ByteSource is a byte range of fixed length that a reader reads at any
offset through &self. The OCP Recovery Agent, which a later PR adds,
holds the recovery image as &dyn ByteSource. PayloadSource has the
same methods, but using it makes the agent crate depend on
services/orchestrator/capabilities, so ByteSource lives in util/io. The
orchestrator on ocp-global-demo already reads its images through
ByteSource.

Signed-off-by: Christina Quast <christina.quast@9elements.com>
Assisted-by: Claude Fable 5.2
@chrysh
chrysh merged commit a299d3b into OpenPRoT:ocp-streaming-recovery Dec 1, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant