Skip to main content

Module ServiceRegistry

Module ServiceRegistry 

Source
Expand description

§Service Registry Module

§RESPONSIBILITIES

  • Track mapping from land:// domain names to local HTTP service ports
  • Provide thread-safe access using Arc<RwLock<>>
  • Support service registration and lookup
  • Enable health checks for registered services

§ARCHITECTURAL ROLE

The ServiceRegistry provides the bridge between land:// URIs and local services:

land://code.editor.land/path ──► ServiceRegistry ──► http://127.0.0.1:PORT/path

§THREAD SAFETY

  • Uses Arc<RwLock<HashMap<String, LocalService>>> for concurrent access
  • Multiple readers allowed concurrently
  • Writers lock exclusively

§USAGE

let registry = ServiceRegistry::new();
registry.register("code.editor.land".to_string(), 8080, Some("/health".to_string()));

let service = registry.lookup("code.editor.land").unwrap();
assert_eq!(service.port, 8080);

Structs§

LocalService
Represents a local HTTP/HTTPS service registered with the land:// scheme
ServiceRegistry
Registry for tracking local HTTP/HTTPS services