Skip to main content

Host

Struct Host 

Source
pub struct Host<T> { /* private fields */ }
Expand description

The remote-host side of a run, over whichever store holds its state.

It is both interfaces at once: a RemoteHost a journey can call directly, and the Hosting factory a run is handed. A host taken from the factory shares this one’s state, so what a publication did is read back through the value the journey created.

Implementations§

Source§

impl Host<MemoryStore<HostState>>

Source

pub fn new() -> Self

A host with nothing opened against it.

Source

pub fn seeded(state: HostState) -> Self

A host that starts from a scenario.

Source

pub fn state(&self) -> HostState

Everything it knows.

Source§

impl Host<FileStore<HostState>>

Source

pub fn create(path: impl Into<PathBuf>) -> Result<Self>

A host keeping its state at path: whatever is already there, or nothing opened against it.

Attaching rather than replacing, so a second host over the same path answers about the change requests the first one opened.

Source

pub fn seeded(path: impl Into<PathBuf>, state: HostState) -> Result<Self>

A host that starts from a scenario, keeping its state at path and replacing whatever was there.

Source

pub fn state(&self) -> Result<HostState>

Everything it knows, read back out of its document.

Trait Implementations§

Source§

impl<T: Debug> Debug for Host<T>

Source§

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

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

impl<T: Store<HostState> + Clone + Debug + Send + Sync + 'static> Hosting for Host<T>

Source§

fn for_repo(&self, slug: &str) -> Result<Box<dyn RemoteHost>>

The host that answers for the repository named owner/name.
Source§

impl<T: Store<HostState>> RemoteHost for Host<T>

Source§

fn authenticated_user(&self) -> Result<String>

Who the host believes is calling.
Source§

fn open_change(&self, req: ChangeSpec) -> Result<ChangeRequest>

Open a change request.
Source§

fn find_changes(&self, head: &str, base: &str) -> Result<Vec<ChangeRequest>>

Every open change request from head into base.
Source§

fn change_checks(&self, cr: &ChangeRequest) -> Result<ChangeChecks>

The checks the host is reporting on a change request, and which of its sources that answer was read from.
Source§

fn check_log(&self, cr: &ChangeRequest, check: &Check) -> Result<ArtifactId>

Store one check’s log as an artifact and return its id.
Source§

fn merge(&self, cr: &ChangeRequest, policy: MergePolicy) -> Result<MergeOutcome>

Merge a change request under a policy.

Auto Trait Implementations§

§

impl<T> Freeze for Host<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Host<T>
where T: RefUnwindSafe,

§

impl<T> Send for Host<T>
where T: Send,

§

impl<T> Sync for Host<T>
where T: Sync,

§

impl<T> Unpin for Host<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Host<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Host<T>
where T: UnwindSafe,

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