pub struct FlinkGuard { /* private fields */ }Expand description
The running guard for a FlinkContainer.
Implementations§
Source§impl FlinkGuard
impl FlinkGuard
Sourcepub fn rest_url(&self) -> String
pub fn rest_url(&self) -> String
The JobManager REST base URI (/overview, /taskmanagers, job submission,
etc.).
Sourcepub async fn stop(self) -> Result<()>
pub async fn stop(self) -> Result<()>
Stops and removes the TaskManager (if any) and the JobManager, then closes the
network created by FlinkContainer::with_task_manager (if any) — this module
created that network internally, not the caller, so it owns closing it too, or
a repeated-boot test/process leaks one per run.
Methods from Deref<Target = ContainerGuard>§
Sourcepub fn network(&self) -> Option<&Arc<Network>>
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.
Sourcepub fn host(&self) -> &str
pub fn host(&self) -> &str
The host address published ports are reachable on — always loopback.
Sourcepub fn get_mapped_port(&self, guest_port: u16) -> Result<u16, RightsizeError>
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.
Sourcepub async fn logs(&self) -> Result<String, RightsizeError>
pub async fn logs(&self) -> Result<String, RightsizeError>
The full logs captured so far. Requires the container to be running.
Sourcepub async fn exec(&self, cmd: &[&str]) -> Result<ExecResult, RightsizeError>
pub async fn exec(&self, cmd: &[&str]) -> Result<ExecResult, RightsizeError>
Runs cmd inside the running container and returns its exit code and captured
output.
Sourcepub async fn follow_output(
&self,
consumer: impl Fn(String) + Send + Sync + 'static,
) -> Result<FollowHandle, RightsizeError>
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.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
True from a successful start() until stop(); false before the first start()
and after.