Skip to main content

HostState

Struct HostState 

Source
pub struct HostState {
Show 13 fields pub version: u32, pub authenticated_user: String, pub changes: Vec<ChangeRequest>, pub heads: BTreeMap<ChangeId, String>, pub titles: BTreeMap<ChangeId, String>, pub bodies: BTreeMap<ChangeId, String>, pub checks: BTreeMap<ChangeId, Vec<Check>>, pub check_logs: BTreeMap<ChangeId, BTreeMap<String, String>>, pub drafts: BTreeMap<ChangeId, DraftReason>, pub made_ready: Vec<ChangeId>, pub described: Vec<Described>, 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.

§bodies: BTreeMap<ChangeId, String>

The body each change request was opened with, for the change requests that were opened with one.

Beside titles and for its reason: the body is what a caller passes on the PublishRequest and nothing else records it, so a journey asserting that the body it drafted is the one the host was given has nowhere else to read it. A change request with no entry was opened with no body at all, which is what a publication nobody gave one does — the two are different scenarios, and an empty string is the first rather than the second.

§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.

§drafts: BTreeMap<ChangeId, DraftReason>

The reason each change request that was opened as a draft was drafted with, for the change requests that were.

Beside bodies and for its reason: the reason is what a caller passes on the PublishRequest and this is where a journey reads back that the host was given it. A change with no entry is not a draft, which is what every change request opened without one is.

Nothing is refused about the reason itself here. Its shape — that every field of it renders as the one line it is printed on — is onevcs’s own rule, and it is applied where a publication takes one in, before any host is asked.

§made_ready: Vec<ChangeId>

Every ready_for_review call this host has taken, in the order it took them — the lifts it was asked to perform, never a request for a reviewer.

A list rather than a set, and beyond the sketch for a reason a set could not serve: lifting a draft is required to be idempotent, so what a journey asserts is that a second publication asked the host for nothing — and only a record of the calls themselves can say that. A change named here is not a draft any more, whatever drafts says it was opened as.

§described: Vec<Described>

Every describe_change call this host has taken, in the order it took them: which change request, the title it was handed when it was handed one, and the body.

The calls themselves, for the reason made_ready is: what a journey asks is what a closeout wrote, call by call, and the current title and body — which each call also writes into titles and bodies, so change_description answers from the same record open_change wrote — can only say where the description ended up.

§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 carry_forward(&mut self)

A version 2 document held no bodies, and a version 5 document’s checks named no commit; each reads as what it was — change requests opened with none, and checks whose head that build never recorded. There is nothing to fill in — an absent field is already that answer, and a check’s commit is the one thing that must never be inferred — so this is the version and nothing else. The one carry a version 8 document needs, the kind its draft reasons lack, is done where those are read (drafts_of_any_version), because it is a fact about one value’s shape rather than about the document.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.