pub struct SocketTransport {
pub welcome: Welcome,
/* private fields */
}Fields§
§welcome: WelcomeImplementations§
Source§impl SocketTransport
impl SocketTransport
Sourcepub async fn connect(
path: &Path,
hello: Hello,
) -> Result<Connected, TransportError>
pub async fn connect( path: &Path, hello: Hello, ) -> Result<Connected, TransportError>
Hello/Welcome only (50 ms connect + 2 s handshake budgets).
Sourcepub async fn attach(
conn: Connected,
attach: Attach,
) -> Result<(Self, AttachSnapshot), TransportError>
pub async fn attach( conn: Connected, attach: Attach, ) -> Result<(Self, AttachSnapshot), TransportError>
Attach (existing or create) on a handshaken connection. AttachRefused
and DaemonFrame::Error alike → TransportError::Refused. Waits
ATTACH_TIMEOUT_PARKED when the daemon lists the session as Parked.
Sourcepub fn last_error(&self) -> Option<&TransportError>
pub fn last_error(&self) -> Option<&TransportError>
Why the last next_event returned None (if it was not a plain end).
Sourcepub fn is_reload_pending(&self) -> bool
pub fn is_reload_pending(&self) -> bool
true if the daemon announced a reload before EOF (graceful); false
means a crash/SIGKILL (unexpected).
Sourcepub fn daemon_pid(&self) -> u32
pub fn daemon_pid(&self) -> u32
The pid the daemon reported in Welcome.
Sourcepub fn reconnect_budget() -> Duration
pub fn reconnect_budget() -> Duration
The reconnect budget from SYNAPS_TUI_ATTACH_RECONNECT_SECS (default 60).
Sourcepub async fn reconnect_once(
&mut self,
mode: AttachMode,
) -> Result<AttachSnapshot, TransportError>
pub async fn reconnect_once( &mut self, mode: AttachMode, ) -> Result<AttachSnapshot, TransportError>
One attempt at reconnecting (Hello + Attach). On success replaces
self and returns the snapshot. On Refused / Version the error is
terminal (caller should stop retrying). Other errors are transient.
pub async fn ping(path: &Path) -> Result<Pong, TransportError>
pub async fn sessions(path: &Path) -> Result<Vec<SessionMeta>, TransportError>
pub async fn shutdown(path: &Path, force: bool) -> Result<(), TransportError>
pub async fn purge(path: &Path) -> Result<Pong, TransportError>
Sourcepub async fn reload(
path: &Path,
now: bool,
drain_secs: Option<u64>,
exe: Option<PathBuf>,
) -> Result<u64, TransportError>
pub async fn reload( path: &Path, now: bool, drain_secs: Option<u64>, exe: Option<PathBuf>, ) -> Result<u64, TransportError>
Reload{..} on a control connection. Ok(generation) once the daemon
answered Bye{Reloading{generation}} (it is about to exec);
Refused{ReloadRefused} / Error → Err.
Sourcepub fn messages(&self) -> &[SharedMessage] ⓘ
pub fn messages(&self) -> &[SharedMessage] ⓘ
The client’s view of api_messages (kept current by the digest
protocol in Full mode; always empty in Digest mode).
Sourcepub fn last_frame_bytes(&self) -> usize
pub fn last_frame_bytes(&self) -> usize
Length in bytes of the last frame decoded on this connection
(the Attached frame right after attach).
pub fn history_mode(&self) -> HistoryMode
Trait Implementations§
Source§impl ClientTransport for SocketTransport
impl ClientTransport for SocketTransport
Source§fn send_from_self<'life0, 'async_trait>(
&'life0 self,
cmd: SessionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_from_self<'life0, 'async_trait>(
&'life0 self,
cmd: SessionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The daemon’s conn stamps from with this connection’s client id, so
on the wire send and send_from_self are the same frame.
Source§fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
mode: AttachMode,
) -> Pin<Box<dyn Future<Output = Result<AttachSnapshot, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
mode: AttachMode,
) -> Pin<Box<dyn Future<Output = Result<AttachSnapshot, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
C3: after Reloading/EOF — backoff 100 ms ×2 → cap 5 s, total ≤
SYNAPS_TUI_ATTACH_RECONNECT_SECS (60); Hello{reconnect_of} →
Attach::Existing{alias-resolved id, mode} where mode = Takeover
iff this client was the input owner (§2.7: two reconnecting mirrors
cannot both take over). On success self IS the new connection; the
returned snapshot is a full re-mirror.
fn session_id(&self) -> &SessionId
fn meta(&self) -> &SessionMeta
Source§fn send<'life0, 'async_trait>(
&'life0 self,
cmd: SessionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
cmd: SessionCommand,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
from: None; bypasses input ownership).Source§fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<Envelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<Envelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
None when the session ended / socket closed.Source§fn view(&self) -> Arc<RuntimeView> ⓘ
fn view(&self) -> Arc<RuntimeView> ⓘ
SettingChanged: what the
TUI’s getters read on day 2.Source§fn mode(&self) -> AttachMode
fn mode(&self) -> AttachMode
Source§fn input_owner(&self) -> Option<ClientId>
fn input_owner(&self) -> Option<ClientId>
Attached / InputOwnerChanged.Source§fn reconnect_once<'life0, 'async_trait>(
&'life0 mut self,
mode: AttachMode,
) -> Pin<Box<dyn Future<Output = Result<AttachSnapshot, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reconnect_once<'life0, 'async_trait>(
&'life0 mut self,
mode: AttachMode,
) -> Pin<Box<dyn Future<Output = Result<AttachSnapshot, TransportError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn is_reload_pending(&self) -> bool
fn is_reload_pending(&self) -> bool
true if the daemon announced a reload before EOF (graceful). Always
false on LocalTransport.Source§fn daemon_pid(&self) -> u32
fn daemon_pid(&self) -> u32
Welcome. Returns 0 on LocalTransport.Auto Trait Implementations§
impl !RefUnwindSafe for SocketTransport
impl !UnwindSafe for SocketTransport
impl Freeze for SocketTransport
impl Send for SocketTransport
impl Sync for SocketTransport
impl Unpin for SocketTransport
impl UnsafeUnpin for SocketTransport
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.