Skip to main content

sync_auth/backend/
mod.rs

1//! Git backend for credential storage and retrieval.
2
3mod git;
4
5pub use git::GitRepo;
6
7use std::path::Path;
8
9/// Trait for Git-like backends that store and retrieve credential snapshots.
10///
11/// Implement this trait to provide a custom storage backend (e.g. GitLab,
12/// a custom Git server, or even a non-Git store).
13#[async_trait::async_trait]
14pub trait GitBackend: Send + Sync {
15    /// Clone the repository (shallow if supported) to `local_path`.
16    async fn clone_repo(
17        &self,
18        url: &str,
19        local_path: &Path,
20        shallow: bool,
21    ) -> Result<(), crate::SyncError>;
22
23    /// Pull latest changes from remote.
24    async fn pull(&self, local_path: &Path) -> Result<(), crate::SyncError>;
25
26    /// Stage, commit, and push local changes.
27    async fn push(&self, local_path: &Path, message: &str) -> Result<(), crate::SyncError>;
28
29    /// Check if the local path is already a valid repo clone.
30    fn is_cloned(&self, local_path: &Path) -> bool;
31}