Struct ExecuteContext

Source
pub struct ExecuteContext<W>
where W: Write,
{ pub log: W, pub pb: ProgressBar, pub status_dir: Arc<TempDir>, pub id: Option<String>, pub status_file: Option<PathBuf>, pub log_file: Option<PathBuf>, }
Expand description

A context used in task execution

Fields§

§log: W

Global log file object. (aka. risedev.log)

§pb: ProgressBar

Progress bar on screen.

§status_dir: Arc<TempDir>

The directory for checking status.

RiseDev will instruct every task to output their status to a file in temporary folder. By checking this file, we can know whether a task has early exited.

§id: Option<String>

The current service id running in this context.

§status_file: Option<PathBuf>

The status file corresponding to the current context.

§log_file: Option<PathBuf>

The log file corresponding to the current context. (e.g. frontend-4566.log)

Implementations§

Source§

impl<W> ExecuteContext<W>
where W: Write,

Source

fn wait_log_contains(&mut self, patterns: &[String]) -> Result<()>

Source§

impl<W> ExecuteContext<W>
where W: Write,

Source

pub fn new(log: W, pb: ProgressBar, status_dir: Arc<TempDir>) -> Self

Source

pub fn service(&mut self, task: &impl Task)

Source

pub fn run_command(&mut self, cmd: Command) -> Result<Output>

Source

pub fn complete_spin(&mut self)

Source

pub fn status_path(&self) -> PathBuf

Source

pub fn log_path(&self) -> &Path

Source

pub fn wait_tcp(&mut self, server: impl AsRef<str>) -> Result<()>

Source

fn wait_http_with_response_cb( &mut self, server: impl AsRef<str>, cb: impl Fn(Response) -> Result<()>, ) -> Result<()>

Source

pub fn wait_http(&mut self, server: impl AsRef<str>) -> Result<()>

Source

pub fn wait_http_with_text_cb( &mut self, server: impl AsRef<str>, cb: impl Fn(&str) -> bool, ) -> Result<()>

Source

pub fn wait(&mut self, wait_func: impl FnMut() -> Result<()>) -> Result<()>

Source

pub fn wait_tcp_close(&mut self, server: impl AsRef<str>) -> Result<()>

Wait for a TCP port to close

Source

pub fn wait_tcp_user(&mut self, server: impl AsRef<str>) -> Result<()>

Wait for a user-managed service to be available

Source

pub fn tmux_run(&self, user_cmd: Command) -> Result<Command>

Auto Trait Implementations§

§

impl<W> Freeze for ExecuteContext<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for ExecuteContext<W>
where W: RefUnwindSafe,

§

impl<W> Send for ExecuteContext<W>
where W: Send,

§

impl<W> Sync for ExecuteContext<W>
where W: Sync,

§

impl<W> Unpin for ExecuteContext<W>
where W: Unpin,

§

impl<W> UnwindSafe for ExecuteContext<W>
where W: 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more