Rename setups and add provider reauthentication

This commit is contained in:
iris committed 2026-09-12 22:56:43 -04:00
1 parent e9a0f1b9da
commit 7d9df5d572
36 files changed
+1866 -684

No files matched your search

+20 -20
View File
@@ -48,16 +48,16 @@ impl Operation {
#[serde(rename_all = "camelCase", tag = "state")]
pub enum Change {
Started {
setup: String,
machine: String,
session: String,
operation: Operation,
},
Finished {
setup: String,
machine: String,
session: String,
},
Failed {
setup: String,
machine: String,
session: String,
message: String,
},
@@ -66,11 +66,11 @@ pub enum Change {
impl Change {
/// Which machine this is about, so a stream scoped to one can drop the rest.
/// Every variant carries it; matching here keeps that fact in one place.
pub fn setup(&self) -> &str {
pub fn machine(&self) -> &str {
match self {
Self::Started { setup, .. }
| Self::Finished { setup, .. }
| Self::Failed { setup, .. } => setup,
Self::Started { machine, .. }
| Self::Finished { machine, .. }
| Self::Failed { machine, .. } => machine,
}
}
}
@@ -106,12 +106,12 @@ impl Registry {
/// [`InFlight::succeeded`] or [`InFlight::failed`], or drop it and it reports
/// a failure. Dropping without settling means the task was cancelled or
/// panicked, and a row stuck on "importing" for ever is a worse answer.
pub fn begin(self: &Arc<Self>, setup: &str, session: &str, operation: Operation) -> InFlight {
let key = (setup.to_string(), session.to_string());
pub fn begin(self: &Arc<Self>, machine: &str, session: &str, operation: Operation) -> InFlight {
let key = (machine.to_string(), session.to_string());
self.running.lock().unwrap().insert(key.clone(), operation);
self.failures.lock().unwrap().remove(&key);
let _ = self.changes.send(Change::Started {
setup: key.0.clone(),
machine: key.0.clone(),
session: key.1.clone(),
operation,
});
@@ -123,25 +123,25 @@ impl Registry {
}
/// What is happening to this session, if anything is.
pub fn running(&self, setup: &str, session: &str) -> Option<Operation> {
let key = (setup.to_string(), session.to_string());
pub fn running(&self, machine: &str, session: &str) -> Option<Operation> {
let key = (machine.to_string(), session.to_string());
self.running.lock().unwrap().get(&key).copied()
}
/// How the last operation on this session failed, if it did.
pub fn failure(&self, setup: &str, session: &str) -> Option<String> {
let key = (setup.to_string(), session.to_string());
pub fn failure(&self, machine: &str, session: &str) -> Option<String> {
let key = (machine.to_string(), session.to_string());
self.failures.lock().unwrap().get(&key).cloned()
}
/// Forgets failures against sessions the machine no longer has. Called from
/// the listing, which is the only place that knows what is still there.
pub fn prune(&self, setup: &str, present: &[String]) {
pub fn prune(&self, machine: &str, present: &[String]) {
self.failures
.lock()
.unwrap()
.retain(|(kept_setup, session), _| {
kept_setup != setup || present.iter().any(|id| id == session)
.retain(|(kept_machine, session), _| {
kept_machine != machine || present.iter().any(|id| id == session)
});
}
@@ -174,7 +174,7 @@ impl InFlight {
}
self.settled = true;
self.registry.running.lock().unwrap().remove(&self.key);
let (setup, session) = (self.key.0.clone(), self.key.1.clone());
let (machine, session) = (self.key.0.clone(), self.key.1.clone());
let change = match failure {
Some(message) => {
self.registry
@@ -183,12 +183,12 @@ impl InFlight {
.unwrap()
.insert(self.key.clone(), message.clone());
Change::Failed {
setup,
machine,
session,
message,
}
}
None => Change::Finished { setup, session },
None => Change::Finished { machine, session },
};
let _ = self.registry.changes.send(change);
}