Trait git_transport::client::Transport[][src]

pub trait Transport {
    fn handshake(
        &mut self,
        service: Service
    ) -> Result<SetServiceResponse<'_>, Error>;
fn request(
        &mut self,
        write_mode: WriteMode,
        on_into_read: MessageKind
    ) -> Result<RequestWriter<'_>, Error>;
fn close(&mut self) -> Result<(), Error>;
fn to_url(&self) -> String;
fn desired_protocol_version(&self) -> Protocol;
fn is_stateful(&self) -> bool; fn set_identity(&mut self, _identity: Identity) -> Result<(), Error> { ... } }

All methods provided here must be called in the correct order according to the communication protocol used to connect to them. It does, however, know just enough to be able to provide a higher-level interface than would otherwise be possible. Thus the consumer of this trait will not have to deal with packet lines at all. Note that whenever a Read trait or Write trait is produced, it must be exhausted.

Required methods

fn handshake(
    &mut self,
    service: Service
) -> Result<SetServiceResponse<'_>, Error>
[src]

Initiate connection to the given service. Returns the service capabilities according according to the actual Protocol it supports, and possibly a list of refs to be obtained. This means that asking for an unsupported protocol will result in a protocol downgrade to the given one. using the read_line(…) function of the given BufReader. It must be exhausted, that is, read to the end before the next method can be invoked.

fn request(
    &mut self,
    write_mode: WriteMode,
    on_into_read: MessageKind
) -> Result<RequestWriter<'_>, Error>
[src]

Get a writer for sending data and obtaining the response. It can be configured in various ways to support the task at hand. write_mode determines how calls to the write(…) method are interpreted, and on_into_read determines which message to write when the writer is turned into the response reader using into_read().

fn close(&mut self) -> Result<(), Error>[src]

Closes the connection to indicate no further requests will be made.

fn to_url(&self) -> String[src]

Returns the canonical URL pointing to the destination of this transport. Please note that local paths may not be represented correctly, as they will go through a potentially lossy unicode conversion.

fn desired_protocol_version(&self) -> Protocol[src]

Returns the protocol version that was initially desired upon connection Please note that the actual protocol might differ after the handshake was conducted in case the server did not support it.

fn is_stateful(&self) -> bool[src]

Returns true if the transport is inherently stateful, or false otherwise. Not being stateful implies that certain information has to be resent on each ‘turn’ of the fetch negotiation.

Implementation Details

This answer should not be based on the Protocol itself, which might enforce stateless interactions despite the connections staying intact which might imply statefulness.

Loading content...

Provided methods

fn set_identity(&mut self, _identity: Identity) -> Result<(), Error>[src]

If the handshake or subsequent reads failed with io::ErrorKind::PermissionDenied, use this method to inform the transport layer about the identity to use for subsequent calls. If authentication continues to fail even with an identity set, consider communicating this to the provider of the identity in order to mark it as invalid. Otherwise the user might have difficulty updating obsolete credentials. Please note that most transport layers are unauthenticated and thus return an error here.

Loading content...

Implementations on Foreign Types

impl<T: Transport + ?Sized> Transport for Box<T>[src]

Loading content...

Implementors

impl Transport for SpawnProcessOnDemand[src]

impl<R, W> Transport for Connection<R, W> where
    R: Read,
    W: Write
[src]

Loading content...