pub struct ControlState {
pub version: u32,
pub instance_id: Option<String>,
pub targets: BTreeMap<String, TargetControl>,
pub rebuild_pending: Option<UtcTimestamp>,
pub rebuilt_for: BTreeSet<(String, String)>,
}Expand description
control.json.
Fields§
§version: u32§instance_id: Option<String>The instance the controls were issued for.
targets: BTreeMap<String, TargetControl>§rebuild_pending: Option<UtcTimestamp>Since when the file was found damaged: refuse until the relay has the replay (M12).
rebuilt_for: BTreeSet<(String, String)>While a rebuild is pending: the agents (agent id, project id) of the hellos whose replay Hive has confirmed since. Hive replays a project’s controls only for the hello that first announces it, so these agents run again while the others wait for theirs; the rebuild ends once every announced project is confirmed.
Implementations§
Source§impl ControlState
impl ControlState
Sourcepub fn load(data_dir: &Path) -> Result<Self, HiveError>
pub fn load(data_dir: &Path) -> Result<Self, HiveError>
Load <data>/bus/control.json for a change (under the lock):
missing = empty; a damaged file or an unknown version is moved aside
and an error (M12): see load_for.
pub fn save(&self, data_dir: &Path) -> Result<(), HiveError>
Sourcepub fn apply(&mut self, instance_id: Option<&str>, frame: &BusFrameV1) -> bool
pub fn apply(&mut self, instance_id: Option<&str>, frame: &BusFrameV1) -> bool
Apply one control frame for instance_id; false when it changed
nothing (not a control frame, or not newer than the target’s last).
Sourcepub fn admission(&self, agent_id: Option<&str>) -> Option<Refusal>
pub fn admission(&self, agent_id: Option<&str>) -> Option<Refusal>
Whether agent_id (None: an unknown caller, bound by * only) may
run a mutating tool. stop wins over hold; a pending rebuild
refuses unless a stop already does.
Sourcepub fn vetoed(
&self,
agent_id: Option<&str>,
target_ref: &str,
) -> Option<Refusal>
pub fn vetoed( &self, agent_id: Option<&str>, target_ref: &str, ) -> Option<Refusal>
Whether the lease or handoff target_ref is vetoed for agent_id.
Sourcepub fn active(&self) -> Vec<ActiveControl>
pub fn active(&self) -> Vec<ActiveControl>
Every control in force, * first, then by agent and target_ref.
Trait Implementations§
Source§impl Clone for ControlState
impl Clone for ControlState
Source§impl Debug for ControlState
impl Debug for ControlState
Source§impl Default for ControlState
impl Default for ControlState
Source§impl<'de> Deserialize<'de> for ControlState
impl<'de> Deserialize<'de> for ControlState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ControlState
Source§impl PartialEq for ControlState
impl PartialEq for ControlState
Source§impl Serialize for ControlState
impl Serialize for ControlState
impl StructuralPartialEq for ControlState
Auto Trait Implementations§
impl Freeze for ControlState
impl RefUnwindSafe for ControlState
impl Send for ControlState
impl Sync for ControlState
impl Unpin for ControlState
impl UnsafeUnpin for ControlState
impl UnwindSafe for ControlState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more