pub struct KeyPushState {Show 13 fields
pub selected: HashSet<String>,
pub committed: Vec<String>,
pub list_state: ListState,
pub results: Vec<KeyPushResult>,
pub pin_outcomes: HashMap<String, PinOutcome>,
pub expected_count: usize,
pub cancel: Option<Arc<AtomicBool>>,
pub worker: Option<JoinHandle<()>>,
pub run_id: u64,
pub inflight: InflightChild,
pub key_path: String,
pub trust_new_host_key: bool,
pub pending_prompts: VecDeque<KeyPushPrompt>,
}Expand description
Push state owned by App. Empty between push runs.
Fields§
§selected: HashSet<String>Aliases the user has selected in the picker. Modified by Space
during Screen::KeyPushPicker and frozen into committed on Enter.
committed: Vec<String>Snapshot of selected (in picker order) taken when the user
presses Enter to open Screen::ConfirmKeyPush. Read by the
confirm renderer and by start_key_push. Cleared on cancel or
after the worker spawns. Keeps Screen::ConfirmKeyPush payload
small.
list_state: ListStateCursor in the picker’s host list. Indexes into the picker’s visible host slice.
results: Vec<KeyPushResult>Results accumulated as AppEvent::KeyPushResult lands. Drained
when the run completes and the summary toast / sticky error is
rendered.
pin_outcomes: HashMap<String, PinOutcome>What each landed host’s run said about security key PINs, settled as its result arrives so the PIN markers are still fresh.
expected_count: usizeTotal hosts the current run is targeting. Used to know when the run is “done” so the summary can fire exactly once.
cancel: Option<Arc<AtomicBool>>Cancel flag observed by every worker thread. Set on push-cancel, new push run, or App drop.
worker: Option<JoinHandle<()>>JoinHandle for the worker pool. Joined on App drop.
run_id: u64Monotonic run identifier. Bumped at the start of every push so
stale KeyPushResult events from a previously-cancelled run can
be dropped instead of contaminating the next run’s accumulator.
inflight: InflightChildThe ssh child the worker is running right now. Cancel and shutdown kill it through here instead of waiting for the worker to notice the flag between hosts.
key_path: StringPath of the key the current run pushes, as SshKeyInfo::display_path
spells it. A retry after a dialog looks the key up by this path: the
list is rebuilt after a successful push, so a position would not
survive.
trust_new_host_key: boolTrue when the current run follows an accepted trust dialog, so its
ssh may record a host key it has not seen before. Reset by every
start_run, so it never carries into an ordinary push.
pending_prompts: VecDeque<KeyPushPrompt>Hosts of the finished run that still need an answer, in picker order. Drained one dialog at a time, never while a run is in flight.
Implementations§
Source§impl KeyPushState
impl KeyPushState
Sourcepub fn shutdown(&mut self)
pub fn shutdown(&mut self)
Drop the worker handle gracefully. Called from App::drop so a
panicking unwind cannot leave the push thread running with a
dangling sender. The running child is killed first so the join
returns within the SIGTERM grace window.
Sourcepub fn reset_picker(&mut self)
pub fn reset_picker(&mut self)
Reset picker-only state without touching in-flight worker. Called before opening the picker for a new key so the previous run’s selection set does not bleed in.
Sourcepub fn start_run(
&mut self,
expected: usize,
key_path: String,
trust_new_host_key: bool,
) -> (u64, Arc<AtomicBool>)
pub fn start_run( &mut self, expected: usize, key_path: String, trust_new_host_key: bool, ) -> (u64, Arc<AtomicBool>)
Begin a new push run. Clears the result accumulator, sets the expected host count and the path of the key being pushed, bumps the monotonic run_id (so any stale KeyPushResult events from an aborted previous run can be dropped), constructs a fresh cancel flag and an empty inflight slot and stores them on state. Returns the new run_id together with the cancel handle so the spawned worker can share it.
Sourcepub fn finish_run(&mut self)
pub fn finish_run(&mut self)
Completion path. The worker loop has finished naturally; clear the accumulators and join the worker handle. Safe to call when the worker has already exited.
Sourcepub fn cancel_run(&mut self)
pub fn cancel_run(&mut self)
User-cancel path. The running child is killed and the cancel flag is raised for the worker. Accumulators and pending prompts are cleared and run_id is bumped so in-flight KeyPushResult events from the aborted worker arrive with a stale run_id and are dropped. The worker handle is intentionally NOT joined here so the UI does not block while the thread reaps the child.
Sourcepub fn clear_inflight_state(&mut self)
pub fn clear_inflight_state(&mut self)
Failure recovery after a failed worker spawn. Drops the cancel
handle, zeroes the expected count, and clears the worker slot.
Distinct from finish_run: the worker handle is None here (spawn
failed), and the result accumulator is left intact for any caller
that may want to surface it in the error path.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for KeyPushState
impl !UnwindSafe for KeyPushState
impl Freeze for KeyPushState
impl Send for KeyPushState
impl Sync for KeyPushState
impl Unpin for KeyPushState
impl UnsafeUnpin for KeyPushState
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> 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 more