use async_trait::async_trait; use crate::server::error::ServerResult; use crate::server::request::{AuthContext, RefUpdateBatch, ServerRequest}; use crate::server::stream::{BoxedAsyncRead, IngestReport}; #[async_trait] pub trait ServerBackend: Send + Sync + 'static { async fn authorize(&self, req: &ServerRequest) -> ServerResult; async fn list_refs_stream(&self, req: &ServerRequest) -> ServerResult; async fn produce_pack_stream( &self, req: &ServerRequest, wants: &[String], ) -> ServerResult; async fn ingest_pack_stream( &self, req: &ServerRequest, batch: RefUpdateBatch, ) -> ServerResult; async fn lfs_get_stream(&self, req: &ServerRequest, oid: &str) -> ServerResult; async fn lfs_put_stream( &self, req: &ServerRequest, oid: &str, declared_size: u64, ) -> ServerResult; } pub fn empty_body() -> BoxedAsyncRead { Box::new(tokio::io::empty()) }