swarm-controller: the forge webhook takes two narrow sub-states
This commit is contained in:
parent
0fd9847363
commit
98341e24a6
1 changed files with 231 additions and 42 deletions
|
|
@ -930,7 +930,16 @@ pub(crate) async fn read_declarations<'a>(
|
|||
state: &AppState,
|
||||
hives: impl Iterator<Item = &'a HiveEntry>,
|
||||
) -> Result<Vec<(String, swarm_wire::wanted::HiveWanted)>, (String, anyhow::Error)> {
|
||||
let Some(writer) = state.wanted.as_deref() else {
|
||||
read_declarations_of(state.wanted.as_deref(), hives).await
|
||||
}
|
||||
|
||||
/// [`read_declarations`] over the wanted-state writer alone, for a caller that
|
||||
/// holds only that.
|
||||
pub(crate) async fn read_declarations_of<'a>(
|
||||
writer: Option<&wanted::WantedWriter>,
|
||||
hives: impl Iterator<Item = &'a HiveEntry>,
|
||||
) -> Result<Vec<(String, swarm_wire::wanted::HiveWanted)>, (String, anyhow::Error)> {
|
||||
let Some(writer) = writer else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let mut declared = Vec::new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue