9a0c26e5f6
- Add voting mechanism with term tracking and vote persistence - Implement election triggering logic with majority vote counting - Add primary/replica role transition handling with state management - Integrate health check failure detection for automatic elections - Refactor actor messaging system for distributed coordination - Update repository registration to query cluster for existing primary - Add broadcast mechanism for role change notifications - Implement proper term comparison and duplicate request filtering - Upgrade dependency versions including tokio-util for async utilities - Optimize code formatting and line wrapping for improved readability - Remove redundant blank lines and improve code structure consistency - Enhance error logging and trace information for debugging purposes
38 lines
1011 B
Rust
38 lines
1011 B
Rust
pub mod advertise_refs;
|
|
pub mod fsck;
|
|
pub mod index_pack;
|
|
pub mod list_packfiles;
|
|
pub mod pack_objects;
|
|
pub mod receive_pack;
|
|
pub mod upload_pack;
|
|
|
|
/// A wrapper around ReceiverStream that cancels a token when dropped.
|
|
/// Used to properly clean up child processes when clients disconnect.
|
|
pub struct CancellableReceiverStream<T> {
|
|
inner: tokio_stream::wrappers::ReceiverStream<T>,
|
|
_cancel_guard: tokio_util::sync::DropGuard,
|
|
}
|
|
|
|
impl<T> CancellableReceiverStream<T> {
|
|
pub fn new(
|
|
inner: tokio_stream::wrappers::ReceiverStream<T>,
|
|
cancel_guard: tokio_util::sync::DropGuard,
|
|
) -> Self {
|
|
Self {
|
|
inner,
|
|
_cancel_guard: cancel_guard,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<T> tokio_stream::Stream for CancellableReceiverStream<T> {
|
|
type Item = T;
|
|
|
|
fn poll_next(
|
|
mut self: std::pin::Pin<&mut Self>,
|
|
cx: &mut std::task::Context<'_>,
|
|
) -> std::task::Poll<Option<Self::Item>> {
|
|
std::pin::Pin::new(&mut self.inner).poll_next(cx)
|
|
}
|
|
}
|