Skip to main content

Protocol

Trait Protocol 

Source
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§

Source

fn new(endpoint: Uri) -> Self
where Self: Sized,

Source

fn share_resource( &self, provider_id: &ProviderId, permissions: &HashSet<Permission>, ) -> Result<MultiProtocol, &'static str>

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.

Source

fn endpoint(&self) -> &Uri

Protocol specific URL prefix to access resources shared by this OCM Server using this protocol.

Source

fn identifier(&self) -> &'static str

Identifier of this protocol used in Discovery and in shares.

Examples: webdav, datatx or webapp

Source

fn supported_resource_types(&self) -> &[&str]

Resource types which can be accessed using this protocol.

Examples: file, folder, calendar, …

Source

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".

Implementors§