pub struct ReplicationProtocol { /* private fields */ }Expand description
Repository replication protocol.
Handles incoming P2P messages and coordinates repository synchronization.
Implementations§
Source§impl ReplicationProtocol
impl ReplicationProtocol
Sourcepub fn set_handler(&mut self, handler: Arc<dyn ReplicationHandler>)
pub fn set_handler(&mut self, handler: Arc<dyn ReplicationHandler>)
Set the message handler for sending responses.
Sourcepub fn repos(&self) -> Arc<RwLock<HashMap<String, Arc<Repository>>>>
pub fn repos(&self) -> Arc<RwLock<HashMap<String, Arc<Repository>>>>
Get the repository store reference.
Sourcepub fn register_repo(&self, key: String, repo: Arc<Repository>)
pub fn register_repo(&self, key: String, repo: Arc<Repository>)
Register a repository for replication.
Sourcepub fn get_or_create_repo(&self, key: &str) -> Arc<Repository>
pub fn get_or_create_repo(&self, key: &str) -> Arc<Repository>
Get or create a repository by key.
Sourcepub fn handle_message(
&self,
peer_id: &[u8],
data: &[u8],
) -> Result<Option<Message>>
pub fn handle_message( &self, peer_id: &[u8], data: &[u8], ) -> Result<Option<Message>>
Handle an incoming message from a peer.
Returns an optional response message.
Sourcepub fn broadcast_update(
&self,
repo_key: &str,
new_objects: Vec<ObjectId>,
refs: Vec<(String, ObjectId)>,
)
pub fn broadcast_update( &self, repo_key: &str, new_objects: Vec<ObjectId>, refs: Vec<(String, ObjectId)>, )
Broadcast a repository update to all peers.
Called after a push to notify peers about new objects.
Sourcepub fn broadcast_ref_update(
&self,
repo_key: &str,
ref_name: &str,
old_id: ObjectId,
new_id: ObjectId,
)
pub fn broadcast_ref_update( &self, repo_key: &str, ref_name: &str, old_id: ObjectId, new_id: ObjectId, )
Broadcast a reference update to all peers.
Sourcepub fn get_repo_state(&self, key: &str) -> Option<RepoState>
pub fn get_repo_state(&self, key: &str) -> Option<RepoState>
Get repository state summary for a given repo.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReplicationProtocol
impl !UnwindSafe for ReplicationProtocol
impl Freeze for ReplicationProtocol
impl Send for ReplicationProtocol
impl Sync for ReplicationProtocol
impl Unpin for ReplicationProtocol
impl UnsafeUnpin for ReplicationProtocol
Blanket Implementations§
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
Mutably borrows from an owned value. Read more