Skip to main content

ClickHouseGuard

Struct ClickHouseGuard 

Source
pub struct ClickHouseGuard { /* private fields */ }
Expand description

The running guard for a ClickHouseContainer.

Implementations§

Source§

impl ClickHouseGuard

Source

pub fn username(&self) -> &str

The configured database user (default test).

Source

pub fn password(&self) -> &str

The configured database password (default test).

Source

pub fn database_name(&self) -> &str

The configured database name (default test).

Source

pub fn http_url(&self) -> String

The HTTP interface’s base URI (query via POST with a SQL body, basic-auth’d).

Source

pub async fn stop(self) -> Result<()>

Stops and removes the container, releasing its host ports.

Methods from Deref<Target = ContainerGuard>§

Source

pub fn network(&self) -> Option<&Arc<Network>>

The network this container joined, if any — a module may use this to resolve a sibling’s alias from the guard itself rather than needing to keep a separate Network reference around.

Source

pub fn host(&self) -> &str

The host address published ports are reachable on — always loopback.

Source

pub fn name(&self) -> &str

The backend-facing sandbox name (e.g. rz-<run-id>-<seq>, or rz-reuse-<12hex> for a reuse container — see Container::reuse). This is always the human-readable ledger/reaping name, on every backend — never the docker daemon’s opaque container id — matching what the diagnostics report and the reaping ledger both name this sandbox.

Source

pub fn get_mapped_port(&self, guest_port: u16) -> Result<u16, RightsizeError>

The host port guest_port is published on.

Distinguishes two failure causes: if this guard isn’t running (stopped, or never successfully started), the error says so; if it IS running but guest_port was never declared via with_exposed_ports, the error says the port isn’t exposed.

Source

pub async fn logs(&self) -> Result<String, RightsizeError>

The full logs captured so far. Requires the container to be running.

Source

pub async fn exec(&self, cmd: &[&str]) -> Result<ExecResult, RightsizeError>

Runs cmd inside the running container and returns its exit code and captured output.

Source

pub async fn checkpoint(&self) -> Result<Checkpoint, RightsizeError>

Checkpoints this RUNNING container: commits its current filesystem state into a new image via the active backend’s commit_to_image, and returns a Checkpoint carrying that image’s ref plus this container’s full spec (see Checkpoint’s own doc for the “filesystem capture, not memory” semantics and Container::from_checkpoint for restoring from the result).

Gated on crate::backend::Capabilities::checkpoint BEFORE any backend call: on a backend that doesn’t support it (microsandbox today), this returns RightsizeError::CheckpointUnsupported without ever reaching commit_to_image. Requires this guard to currently be running — a state error otherwise, same shape as Self::exec/Self::logs.

Source

pub async fn follow_output( &self, consumer: impl Fn(String) + Send + Sync + 'static, ) -> Result<FollowHandle, RightsizeError>

Streams log lines to consumer as they’re produced. Closing (or dropping) the returned crate::backend::FollowHandle halts delivery — no further lines reach consumer afterward, even if the container keeps running.

Source

pub fn is_running(&self) -> bool

True from a successful start() until stop(); false before the first start() and after.

Trait Implementations§

Source§

impl Deref for ClickHouseGuard

Source§

type Target = ContainerGuard

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ContainerGuard

Dereferences the value.

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.