pub struct SmartProtocol<R, A>where
R: RepositoryAccess,
A: AuthenticationService,{
pub transport_protocol: TransportProtocol,
pub capabilities: Vec<Capability>,
pub side_band: Option<SideBand>,
pub command_list: Vec<RefCommand>,
pub wire_hash_kind: HashKind,
pub local_hash_kind: HashKind,
pub zero_id: String,
/* private fields */
}Expand description
Smart Git Protocol implementation
This struct handles the Git smart protocol operations for both HTTP and SSH transports. It uses trait abstractions to decouple from specific business logic implementations.
Fields§
§transport_protocol: TransportProtocol§capabilities: Vec<Capability>§side_band: Option<SideBand>§command_list: Vec<RefCommand>§wire_hash_kind: HashKind§local_hash_kind: HashKind§zero_id: StringImplementations§
Source§impl<R, A> SmartProtocol<R, A>where
R: RepositoryAccess,
A: AuthenticationService,
impl<R, A> SmartProtocol<R, A>where
R: RepositoryAccess,
A: AuthenticationService,
Sourcepub fn set_wire_hash_kind(&mut self, kind: HashKind)
pub fn set_wire_hash_kind(&mut self, kind: HashKind)
Set the wire hash kind (sha1 or sha256)
Sourcepub fn new(
transport_protocol: TransportProtocol,
repo_storage: R,
auth_service: A,
) -> Self
pub fn new( transport_protocol: TransportProtocol, repo_storage: R, auth_service: A, ) -> Self
Create a new SmartProtocol instance
Sourcepub async fn authenticate_http(
&self,
headers: &HashMap<String, String>,
) -> Result<(), ProtocolError>
pub async fn authenticate_http( &self, headers: &HashMap<String, String>, ) -> Result<(), ProtocolError>
Authenticate an HTTP request using the injected auth service
Sourcepub async fn authenticate_ssh(
&self,
username: &str,
public_key: &[u8],
) -> Result<(), ProtocolError>
pub async fn authenticate_ssh( &self, username: &str, public_key: &[u8], ) -> Result<(), ProtocolError>
Authenticate an SSH session using username and public key
Sourcepub fn set_transport_protocol(&mut self, protocol: TransportProtocol)
pub fn set_transport_protocol(&mut self, protocol: TransportProtocol)
Set transport protocol (Http, Ssh, etc.)
Sourcepub async fn git_info_refs(
&self,
service_type: ServiceType,
) -> Result<BytesMut, ProtocolError>
pub async fn git_info_refs( &self, service_type: ServiceType, ) -> Result<BytesMut, ProtocolError>
Get git info refs for the repository, with explicit service type
Sourcepub async fn git_upload_pack(
&mut self,
upload_request: Bytes,
) -> Result<(ReceiverStream<Vec<u8>>, BytesMut), ProtocolError>
pub async fn git_upload_pack( &mut self, upload_request: Bytes, ) -> Result<(ReceiverStream<Vec<u8>>, BytesMut), ProtocolError>
Handle git-upload-pack request
Sourcepub fn parse_receive_pack_commands(&mut self, protocol_bytes: Bytes)
pub fn parse_receive_pack_commands(&mut self, protocol_bytes: Bytes)
Parse receive pack commands from protocol bytes
Sourcepub async fn git_receive_pack_stream(
&mut self,
data_stream: ProtocolStream,
) -> Result<Bytes, ProtocolError>
pub async fn git_receive_pack_stream( &mut self, data_stream: ProtocolStream, ) -> Result<Bytes, ProtocolError>
Handle git receive-pack operation (push)
Sourcepub fn build_side_band_format(
&self,
from_bytes: BytesMut,
length: usize,
) -> BytesMut
pub fn build_side_band_format( &self, from_bytes: BytesMut, length: usize, ) -> BytesMut
Builds the packet data in the sideband format if the SideBand/64k capability is enabled.
Sourcepub fn parse_capabilities(&mut self, cap_str: &str)
pub fn parse_capabilities(&mut self, cap_str: &str)
Parse capabilities from capability string
Sourcepub fn parse_ref_command(&self, pkt_line: &mut Bytes) -> RefCommand
pub fn parse_ref_command(&self, pkt_line: &mut Bytes) -> RefCommand
Parse a reference command from packet line
Auto Trait Implementations§
impl<R, A> Freeze for SmartProtocol<R, A>
impl<R, A> RefUnwindSafe for SmartProtocol<R, A>where
R: RefUnwindSafe,
A: RefUnwindSafe,
impl<R, A> Send for SmartProtocol<R, A>
impl<R, A> Sync for SmartProtocol<R, A>
impl<R, A> Unpin for SmartProtocol<R, A>
impl<R, A> UnsafeUnpin for SmartProtocol<R, A>where
R: UnsafeUnpin,
A: UnsafeUnpin,
impl<R, A> UnwindSafe for SmartProtocol<R, A>where
R: UnwindSafe,
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.