pub struct PersistentIpcClientHandle { /* private fields */ }Expand description
Handle to a persistent IPC client that maintains a long-lived connection to the headless sidecar.
The background task automatically:
- Relays
IpcEventframes toapp.emit("background-service://event", ...) - Reconnects on connection failure with exponential backoff (1s–30s, up to 10 retries)
- Forwards commands (start/stop/is_running) over the same connection
Implementations§
Source§impl PersistentIpcClientHandle
impl PersistentIpcClientHandle
Sourcepub fn spawn<R: Runtime>(socket_path: PathBuf, app: AppHandle<R>) -> Self
pub fn spawn<R: Runtime>(socket_path: PathBuf, app: AppHandle<R>) -> Self
Spawn the persistent IPC client background task.
The task immediately begins trying to connect to the socket at
socket_path. Events are relayed to the Tauri event system via
app.emit().
Sourcepub async fn start(&self, config: StartConfig) -> Result<(), ServiceError>
pub async fn start(&self, config: StartConfig) -> Result<(), ServiceError>
Send a Start command through the persistent connection.
Sourcepub async fn stop(&self) -> Result<(), ServiceError>
pub async fn stop(&self) -> Result<(), ServiceError>
Send a Stop command through the persistent connection.
Sourcepub async fn is_running(&self) -> Result<bool, ServiceError>
pub async fn is_running(&self) -> Result<bool, ServiceError>
Query whether the service is running through the persistent connection.
Sourcepub async fn get_state(&self) -> Result<ServiceStatus, ServiceError>
pub async fn get_state(&self) -> Result<ServiceStatus, ServiceError>
Query the current service lifecycle state through the persistent connection.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true if the persistent client is currently connected to the
headless sidecar, false otherwise.
Sourcepub fn socket_path(&self) -> &PathBuf
pub fn socket_path(&self) -> &PathBuf
Returns the socket path this client is configured to connect to.
Sourcepub async fn wait_for_connected(
&self,
timeout: Duration,
) -> Result<bool, ServiceError>
pub async fn wait_for_connected( &self, timeout: Duration, ) -> Result<bool, ServiceError>
Wait until the persistent client is connected, polling is_connected()
at 500ms intervals.
Returns Ok(true) if connected within the timeout, Ok(false) if the
timeout elapsed without connecting.
Sourcepub async fn enable_auto_restart(
&self,
config: Option<StartConfig>,
) -> Result<(), ServiceError>
pub async fn enable_auto_restart( &self, config: Option<StartConfig>, ) -> Result<(), ServiceError>
Enable auto-restart through the persistent connection.
Sourcepub async fn disable_auto_restart(&self) -> Result<(), ServiceError>
pub async fn disable_auto_restart(&self) -> Result<(), ServiceError>
Disable auto-restart through the persistent connection.
Sourcepub async fn get_desired_state(
&self,
) -> Result<Option<DesiredState>, ServiceError>
pub async fn get_desired_state( &self, ) -> Result<Option<DesiredState>, ServiceError>
Get the persisted desired-state through the persistent connection.
Sourcepub async fn validate_setup(
&self,
) -> Result<SetupValidationReport, ServiceError>
pub async fn validate_setup( &self, ) -> Result<SetupValidationReport, ServiceError>
Validate background service setup prerequisites through the persistent connection.
Sourcepub async fn get_lifecycle_status(
&self,
) -> Result<LifecycleStatus, ServiceError>
pub async fn get_lifecycle_status( &self, ) -> Result<LifecycleStatus, ServiceError>
Get the complete lifecycle status snapshot.
Trait Implementations§
Source§impl Drop for PersistentIpcClientHandle
impl Drop for PersistentIpcClientHandle
Auto Trait Implementations§
impl Freeze for PersistentIpcClientHandle
impl RefUnwindSafe for PersistentIpcClientHandle
impl Send for PersistentIpcClientHandle
impl Sync for PersistentIpcClientHandle
impl Unpin for PersistentIpcClientHandle
impl UnsafeUnpin for PersistentIpcClientHandle
impl UnwindSafe for PersistentIpcClientHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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