Skip to main content

Module transport_registry

Module transport_registry 

Source
Expand description

Thread-safe transport registry for custom git transports

This module provides a thread-safe wrapper around libgit2’s transport registration system with proper synchronization and lifecycle management.

§Safety

This module uses unsafe code to call git2::transport::register(). Safety is ensured through:

  • Thread-safe factory storage using Arc<Mutex<HashMap>>
  • Per-scheme registration locks to prevent concurrent registration
  • Reference counting to prevent duplicate registrations
  • Factory trait bounds requiring Send + Sync

§Examples

use git2db::transport_registry::TransportRegistry;
use std::sync::Arc;

let registry = TransportRegistry::new();

// Register a custom transport
// let factory = Arc::new(MyTransportFactory::new());
// registry.register_transport("mycustom".to_owned(), factory).unwrap();

Structs§

RegistryStats
Registry statistics
TransportGuard
Drop guard for automatic transport cleanup
TransportRegistry
Thread-safe transport registry with proper lifecycle management