Trait RemoteIdConvertProtocol

Source
pub trait RemoteIdConvertProtocol:
    Send
    + Sync
    + 'static {
    // Required methods
    fn resolve_names_to_relative_paths<'life0, 'async_trait>(
        &'life0 self,
        heads: Vec<VertexName>,
        names: Vec<VertexName>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn resolve_relative_paths_to_names<'life0, 'async_trait>(
        &'life0 self,
        paths: Vec<AncestorPath>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn is_local(&self) -> bool { ... }
}
Expand description

Abstraction of network protocols.

Required Methods§

Source

fn resolve_names_to_relative_paths<'life0, 'async_trait>( &'life0 self, heads: Vec<VertexName>, names: Vec<VertexName>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ask the server to convert names to “x~n” relative paths.

If a “name” cannot be resolved using “x~n” form in “::heads”, aka. the “heads” are known to the server, and the server can calculate “::heads”, and knows all names (commit hashes) in “::heads”. And the server confirms “name” is outside “::heads” (either because “name” is unknown to the server’s IdMap, or because “name” is known in the server’s IdMap, but the matching Id is outside “::heads”), this method should skip it in the resulting list (instead of returning an error).

Source

fn resolve_relative_paths_to_names<'life0, 'async_trait>( &'life0 self, paths: Vec<AncestorPath>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ask the server to convert “x~n” relative paths back to commit hashes.

Unlike resolve_names_to_relative_paths, failures are not expected. They usually indicate rare events like master moving backwards.

Provided Methods§

Source

fn is_local(&self) -> bool

Return true if the protocol is local and queries do not need to optimize for batching or latency.

Implementations on Foreign Types§

Source§

impl RemoteIdConvertProtocol for ()

Source§

fn resolve_names_to_relative_paths<'life0, 'async_trait>( &'life0 self, _heads: Vec<VertexName>, _names: Vec<VertexName>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn resolve_relative_paths_to_names<'life0, 'async_trait>( &'life0 self, paths: Vec<AncestorPath>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn is_local(&self) -> bool

Source§

impl<IS, M, P, S> RemoteIdConvertProtocol for Arc<AbstractNameDag<IdDag<IS>, M, P, S>>
where IS: IdDagStore, IdDag<IS>: TryClone, M: IdConvert + TryClone + Send + Sync + 'static, P: TryClone + Send + Sync + 'static, S: TryClone + Send + Sync + 'static,

Source§

fn resolve_names_to_relative_paths<'life0, 'async_trait>( &'life0 self, heads: Vec<VertexName>, names: Vec<VertexName>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn resolve_relative_paths_to_names<'life0, 'async_trait>( &'life0 self, paths: Vec<AncestorPath>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AncestorPath, Vec<VertexName>)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

Source§

impl<IS, M, P, S> RemoteIdConvertProtocol for AbstractNameDag<IdDag<IS>, M, P, S>
where IS: IdDagStore, IdDag<IS>: TryClone, M: IdConvert + TryClone + Send + Sync + 'static, P: TryClone + Send + Sync + 'static, S: TryClone + Send + Sync + 'static,