Skip to main content

HostTransport

Enum HostTransport 

Source
pub enum HostTransport {
    Null {
        signed_urls: bool,
        inbound: Arc<InboundBuffer>,
    },
}

Variants§

§

Null

No network: client-local commands only (dependency-lean default).

Fields

§signed_urls: bool

Implementations§

Source§

impl HostTransport

Source

pub fn from_config(config: &Value) -> Result<Self, String>

Build the transport from the new config. {} (or no baseUrl) → Null; a baseUrl under the native-transport feature → Native.

Source

pub fn new_from_config(config: &Value) -> Result<Self, String>

Self::from_config for hosts outside this crate (the bench driver) that own their inbound-frame drain and need no FFI event queue.

Source

pub fn from_config_with_notify( config: &Value, notify: Option<Arc<dyn Fn() + Send + Sync>>, ) -> Result<Self, String>

Build a transport whose realtime reader wakes a mailbox/event loop. The callback is invoked after a frame is buffered and never carries protocol data itself.

Source

pub fn set_signed_urls(&mut self, value: bool)

Source

pub fn set_headers(&mut self, headers: Vec<(String, String)>)

Replace auth/application headers for subsequent HTTP requests and the next realtime connection. A live socket retains its handshake headers.

Source

pub fn take_inbound(&mut self) -> Vec<Inbound>

Drain the inbound realtime frames buffered since the last call.

Source

pub fn shutdown(&mut self)

Release the socket/reader thread. Idempotent.

Trait Implementations§

Source§

impl Transport for HostTransport

Source§

fn sync(&mut self, request: &[u8]) -> Result<Vec<u8>, TransportError>

One combined push+pull round trip (§1.5) over the request/response binding (POST /sync, loopback, …).
Source§

fn realtime_sync(&mut self, request: &[u8]) -> Result<Vec<u8>, TransportError>

One combined push+pull round over the realtime socket (§8.7). The host owns the WS-binding mechanics — channel tags, chunk assembly to the response’s END — and returns the assembled response bytes. The client calls this instead of sync whenever realtime is connected (the socket IS the sync-round transport, not a fallback pair); the server registers the round’s subscriptions on the connection at round end, so no reconnect is needed after subscription changes.
Source§

fn download_segment( &mut self, request: &SegmentRequest, ) -> Result<Vec<u8>, TransportError>

Segment download via the direct endpoint (§5.5).
Source§

fn supports_url_fetch(&self) -> bool

§5.4 direct URL fetch capability: true makes the client advertise accept bit 3 (capability negotiation, §4.2). Default: not capable.
Source§

fn fetch_url(&mut self, url: &str) -> Result<Vec<u8>, TransportError>

Plain GET of a signed URL (§5.4). The URL is the entire grant — implementations MUST NOT attach sync-server authentication or the X-Syncular-Scopes header. Only called when supports_url_fetch returned true.
Source§

fn blob_upload( &mut self, blob_id: &str, bytes: &[u8], media_type: Option<&str>, ) -> Result<(), TransportError>

§5.9.3 blob upload: host-authenticated PUT <mount>/blobs/{blobId}. The server verifies the content address. Default: unsupported.
Source§

fn blob_download( &mut self, blob_id: &str, ) -> Result<BlobDownload, TransportError>

§5.9.5 blob download: host-authenticated GET <mount>/blobs/{blobId}, re-authorized server-side against referencing rows. Returns inline bytes OR (always-issue, presign configured) a signed url the client fetches directly. Default: none.
Source§

fn fetch_blob_url(&mut self, url: &str) -> Result<Vec<u8>, TransportError>

§5.9.5 presigned-download fetch: a bare GET of the signed url. MUST attach NO host authentication — the url is the entire grant (§5.4). Only called when blob_download returned a Url arm.
Source§

fn blob_upload_grant( &mut self, blob_id: &str, byte_length: u64, media_type: Option<&str>, ) -> Result<BlobUploadGrant, TransportError>

§5.9.3 presigned-upload grant: POST /blobs/{blobId}/upload-grant with the declared size. Absent (None) ⇒ the client always streams through blob_upload. A Url grant is PUT via blob_put_url.
Source§

fn blob_put_url( &mut self, url: &str, bytes: &[u8], media_type: Option<&str>, ) -> Result<(), TransportError>

§5.9.3 direct-to-storage PUT of the granted url. MUST attach NO host authentication — the presigned url is the entire grant (§5.4). Only called when blob_upload_grant returned a Url arm.
Source§

fn realtime_connect(&mut self) -> Result<(), TransportError>

Realtime attach (§8.1). Inbound traffic is delivered by the host via SyncClient::on_realtime_text / on_realtime_binary. Legacy host-configured realtime connection. Implementations which do not bind identity at the URL layer may implement only this method.
Source§

fn realtime_connect_for_client( &mut self, client_id: &str, ) -> Result<(), TransportError>

Open realtime for this exact persisted client identity. Native socket servers bind registrations/cursors to the URL-level client id before any protocol frame is exchanged, so client-owned hosts override this. The default preserves compatibility with connectors that already close over their identity.
Source§

fn realtime_send(&mut self, text: &str) -> Result<(), TransportError>

Client → server JSON control message (acks, §8.2).
Source§

fn realtime_close(&mut self) -> Result<(), TransportError>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.