pub trait Backend: Send + Sync {
// Required methods
fn kind(&self) -> BackendKind;
fn capabilities(&self) -> Capabilities;
fn server_ref(&self) -> &str;
fn ensure_session(
&self,
ids: &IdentityStore,
id: &mut SessionIdentity,
invite: Option<&str>,
) -> Result<Session>;
fn execute(
&self,
request: &OutgoingRequest,
) -> Result<HttpResponseDescriptor>;
fn whoami(&self) -> Result<(String, String)>;
fn keep_prefix(&self) -> bool;
fn wait_for_news(&self, timeout: Duration) -> Result<News>;
// Provided method
fn frozen(&self) -> Option<Arc<dyn Backend>> { ... }
}Required Methods§
fn kind(&self) -> BackendKind
fn capabilities(&self) -> Capabilities
Sourcefn server_ref(&self) -> &str
fn server_ref(&self) -> &str
The normalized server base URL this backend talks to (the identity is bound to it).
Sourcefn ensure_session(
&self,
ids: &IdentityStore,
id: &mut SessionIdentity,
invite: Option<&str>,
) -> Result<Session>
fn ensure_session( &self, ids: &IdentityStore, id: &mut SessionIdentity, invite: Option<&str>, ) -> Result<Session>
A live session for id. First time: redeems the operator’s invite (enroll the public key,
proving possession of the private one); afterwards: logs in by signing a fresh challenge.
Reuses the stored token while the server still accepts it. Persists what it learns.
Sourcefn execute(&self, request: &OutgoingRequest) -> Result<HttpResponseDescriptor>
fn execute(&self, request: &OutgoingRequest) -> Result<HttpResponseDescriptor>
Performs one request of the engine as this session (bearer added, token refreshed once by
signature if the server forgot it). Callable from any thread. Needs ensure_session first.
Sourcefn whoami(&self) -> Result<(String, String)>
fn whoami(&self) -> Result<(String, String)>
(user_id, device_id) of the session (what the engine needs to open a core).
Sourcefn keep_prefix(&self) -> bool
fn keep_prefix(&self) -> bool
Whether this server serves the Matrix paths under /_matrix (found out, not assumed).
Sourcefn wait_for_news(&self, timeout: Duration) -> Result<News>
fn wait_for_news(&self, timeout: Duration) -> Result<News>
Waits up to timeout for news for this session: room events pushed on the server’s push
socket, or Idle (timeout, or the server has no push channel and the sync long poll is the
wait).
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".