Skip to main content

HostState

Struct HostState 

Source
pub struct HostState {
    pub version: u32,
    pub authenticated_user: String,
    pub changes: Vec<ChangeRequest>,
    pub heads: BTreeMap<ChangeId, String>,
    pub titles: BTreeMap<ChangeId, String>,
    pub checks: BTreeMap<ChangeId, Vec<Check>>,
    pub check_logs: BTreeMap<ChangeId, BTreeMap<String, String>>,
    pub check_sources: Option<BTreeSet<CheckSource>>,
    pub merges: BTreeMap<ChangeId, MergeOutcome>,
}
Expand description

Everything the remote-host side of a run knows about itself.

Omitted-when-empty and versioned for the same reasons VcsState is.

Fields§

§version: u32

The schema version this state was written at. A document that names none is the one this build writes.

§authenticated_user: String

Who the host says is calling. Empty is refused, exactly as a gh that reports no authenticated user is.

§changes: Vec<ChangeRequest>

Every change request that has been opened or seeded.

§heads: BTreeMap<ChangeId, String>

The head branch each change request was opened from.

Beyond the sketch, and unavoidable: ChangeRequest records only the base it targets, and find_changes matches on the head as well.

§titles: BTreeMap<ChangeId, String>

The title each change request was opened under.

Beyond the sketch, and for the same reason heads is: ChangeRequest records neither, and the title is what a publication’s commit subject becomes — so a journey asserting that the subject it asked for is the one the host was given has nowhere else to read it.

§checks: BTreeMap<ChangeId, Vec<Check>>

The checks the host reports on each change request. A change with no entry has no checks, which is what a repository with no CI reports.

§check_logs: BTreeMap<ChangeId, BTreeMap<String, String>>

The log the host hands over for a check, keyed by change request and then by check name. Beyond the sketch: check_log is one of the six methods, and without this the only log a journey could asssert on is a synthesized one.

§check_sources: Option<BTreeSet<CheckSource>>

Which sources this host answers about its checks from, which is what the real implementation reports alongside them.

Unset is a credential allowed to read everything: the whole rollup, exactly what a host with nothing to hide reports. A journey states a narrower set to be the credential the real one meets in CI — a fine-grained token, which cannot read check runs at all and sees GitHub Actions and nothing else — and states an empty one to be a credential that can read no source at all, which is a refusal rather than “no checks”. Unset and empty are therefore different scenarios, which is why this is an Option rather than a set whose emptiness means “not stated”.

§merges: BTreeMap<ChangeId, MergeOutcome>

What merging each change request did.

Both a script and a record: an entry seeded here is what merge answers, whatever the policy asks for — which is how a journey expresses a host that queues or refuses — and a merge the policy decided is written back here.

Trait Implementations§

Source§

impl Checked for HostState

A seeded host side is refused if it holds a change nothing could address.

Source§

fn check(&self) -> Result<()>

Refuse this state, naming what is wrong with it.
Source§

impl Clone for HostState

Source§

fn clone(&self) -> HostState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HostState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HostState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for HostState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HostState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.