pub trait Protocol:
Send
+ Sync
+ 'static {
// Required methods
fn new(endpoint: Uri) -> Self
where Self: Sized;
fn share_resource(
&self,
provider_id: &ProviderId,
permissions: &HashSet<Permission>,
) -> Result<MultiProtocol, &'static str>;
fn endpoint(&self) -> &Uri;
fn identifier(&self) -> &'static str;
fn supported_resource_types(&self) -> &[&str];
fn resolve_client_properties(
&self,
sending_server: &Discovery,
new_share: &NewShare,
) -> Result<MultiProtocol, ProtocolError>;
}Expand description
This trait represents protocols which can be used for data transfer between OCM Servers.
Required Methods§
fn new(endpoint: Uri) -> Selfwhere
Self: Sized,
Share a resource using this protocol.
Returns the necessary metadata to access the shared resource at the Sending Server, including e.g. shared secrets and URLs for accessing the share. URLs can be relative to the protocol specific endpoint prefix advertised in discovery.
Sourcefn endpoint(&self) -> &Uri
fn endpoint(&self) -> &Uri
Protocol specific URL prefix to access resources shared by this OCM Server using this protocol.
Sourcefn identifier(&self) -> &'static str
fn identifier(&self) -> &'static str
Sourcefn supported_resource_types(&self) -> &[&str]
fn supported_resource_types(&self) -> &[&str]
Resource types which can be accessed using this protocol.
Examples: file, folder, calendar, …
Sourcefn resolve_client_properties(
&self,
sending_server: &Discovery,
new_share: &NewShare,
) -> Result<MultiProtocol, ProtocolError>
fn resolve_client_properties( &self, sending_server: &Discovery, new_share: &NewShare, ) -> Result<MultiProtocol, ProtocolError>
This translates URLs relative to URL prefixes to URLs relative to Sending Server root path.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".