pub struct InstructionProgress { /* private fields */ }Expand description
Tracks build progress by parsing buildah commit markers out of the build’s log stream and reconstructing per-instruction TUI events.
Construct with InstructionProgress::new (a flattened
(stage_idx, inst_idx, text) list) or the convenience
InstructionProgress::from_planned_stages. Feed each log line through
InstructionProgress::on_line; it returns the BuildEvents the caller
should forward.
Implementations§
Source§impl InstructionProgress
impl InstructionProgress
Sourcepub fn new(planned: Vec<(usize, usize, String)>) -> Self
pub fn new(planned: Vec<(usize, usize, String)>) -> Self
Build a progress tracker from a flattened, ordered list of planned
instructions: (stage_idx, inst_idx, instruction_text). The list MUST
be in Dockerfile order and exclude FROM lines (which get no commit
marker).
Sourcepub fn from_planned_stages(stages: &[PlannedStage]) -> Self
pub fn from_planned_stages(stages: &[PlannedStage]) -> Self
Build a progress tracker from the planned stages, flattening each
stage’s instructions into (stage_idx, inst_idx, text) in order.
Sourcepub fn current(&self) -> Option<(usize, usize)>
pub fn current(&self) -> Option<(usize, usize)>
The current (stage, index) if the cursor still points at a planned
instruction.
Sourcepub fn current_text(&self) -> &str
pub fn current_text(&self) -> &str
The current instruction’s text (empty string once exhausted).
Sourcepub fn start_first(&self) -> Vec<BuildEvent>
pub fn start_first(&self) -> Vec<BuildEvent>
Emit the initial BuildEvent::InstructionStarted for the first planned
instruction, if any. Call once after sending BuildPlan.
Sourcepub fn on_line(&mut self, line: &str, is_stderr: bool) -> Vec<BuildEvent>
pub fn on_line(&mut self, line: &str, is_stderr: bool) -> Vec<BuildEvent>
Process a single log line.
Always returns a BuildEvent::Output mirroring the raw line. When the
line is a buildah commit marker (--> ...), it additionally advances the
cursor and appends the matching BuildEvent::InstructionComplete, an
optional BuildEvent::StageComplete on a stage boundary, and the next
BuildEvent::InstructionStarted.
Auto Trait Implementations§
impl Freeze for InstructionProgress
impl RefUnwindSafe for InstructionProgress
impl Send for InstructionProgress
impl Sync for InstructionProgress
impl Unpin for InstructionProgress
impl UnsafeUnpin for InstructionProgress
impl UnwindSafe for InstructionProgress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request