How harut8/resilience_h8 works
Project Type and Purpose
• This is a Python library (packaged under resilience_h8) providing resilience patterns (bulkhead, circuit breaker, retry, timeout, rate limiter) and concurrency control for microservices.
• It offers a Decorator API and a ResilienceService façade to apply these patterns to user‐defined (async) functions.
File Structure
• Top‐level directories:
• src/resilience_h8/concurrency/ – task manager implementations (sync + async)
• src/resilience_h8/resilience/ – pattern implementations (bulkhead, circuit breaker, retry, rate limiter, decorators, etc.)
• src/resilience_h8/interfaces/ – abstract interfaces for concurrency and resilience components
• src/resilience_h8/custom_types/ – shared type definitions for stronger typing
• Config & build: pyproject.toml, mypy.ini, pre-commit, tests in tests/, usage examples in examples/.
README Insights
• Core façade: ResilienceService(task_manager, logger)
• Two usage modes: chain decorators individually or via with_resilience(...) combined decorator
• Patterns are composable; each pattern implements .execute() + decorator wrapper
Detailed Component Breakdown to Capture
• ResilienceService (Facade)
• with_retry / with_circuit_breaker / with_bulkhead / with_timeout decorators
• StandardRetryHandler, StandardCircuitBreaker, StandardBulkhead, RateLimiter
• AsyncTaskManager / StandardTaskManager
• Interfaces: IResiliencePattern, ITaskManager
• Custom Types: ResilienceConfig, TaskResult (to show type flow)
• External: Client Code, AsyncClient (httpx), Logger