pub enum HostTransport {
Null {
signed_urls: bool,
inbound: Arc<InboundBuffer>,
},
}Variants§
Null
No network: client-local commands only (dependency-lean default).
Implementations§
Source§impl HostTransport
impl HostTransport
Sourcepub fn from_config(config: &Value) -> Result<Self, String>
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.
Sourcepub fn new_from_config(config: &Value) -> Result<Self, String>
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.
Sourcepub fn from_config_with_notify(
config: &Value,
notify: Option<Arc<dyn Fn() + Send + Sync>>,
) -> Result<Self, String>
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.
pub fn set_signed_urls(&mut self, value: bool)
Sourcepub fn set_headers(&mut self, headers: Vec<(String, String)>)
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.
Sourcepub fn take_inbound(&mut self) -> Vec<Inbound>
pub fn take_inbound(&mut self) -> Vec<Inbound>
Drain the inbound realtime frames buffered since the last call.
Trait Implementations§
Source§impl Transport for HostTransport
impl Transport for HostTransport
Source§fn sync(&mut self, request: &[u8]) -> Result<Vec<u8>, TransportError>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
fn realtime_send(&mut self, text: &str) -> Result<(), TransportError>
Client → server JSON control message (acks, §8.2).
fn realtime_close(&mut self) -> Result<(), TransportError>
Auto Trait Implementations§
impl !RefUnwindSafe for HostTransport
impl !UnwindSafe for HostTransport
impl Freeze for HostTransport
impl Send for HostTransport
impl Sync for HostTransport
impl Unpin for HostTransport
impl UnsafeUnpin for HostTransport
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
Mutably borrows from an owned value. Read more