-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Title: Implement Distributed Circuit Breaker #70
Title: Implement Distributed Circuit Breaker #70
Conversation
Thank you for your PR. The latest implementation is under |
@YoshiyukiMineo I have move the implementation under v2. Could you please review it? |
Hi reviewers, I've addressed the previous feedback. Would appreciate another look when you have a chance. Thanks! |
Thanks. I have merged your PR into |
* Title: Implement Distributed Circuit Breaker (#70) * feature/redis-circuit-breaker * feature/redis-circuit-breaker * Refactor * save state * Saving half-open state also * Saving half-open state also * Added test case * Saving state transition * Pass context * Moved redis circuit breaker to v2 * Revert go.mod and go.sum * Acked review comments * Refactor * Refactor --------- Co-authored-by: Kalpit Pant <[email protected]> * Rename * Rename * Refactor * Rename * Rename * Use generic cache store (#74) Co-authored-by: Kalpit Pant <[email protected]> * Update distributed_gobreaker.go * Update distributed_gobreaker.go * Update distributed_gobreaker.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go * Update distributed_gobreaker_test.go --------- Co-authored-by: kp <[email protected]> Co-authored-by: Kalpit Pant <[email protected]>
Could you please add the tag as well? So that we can download the implementation through go modules. |
Distributed Circuit Breaker Implementation
Overview
This implementation introduces a distributed version of our circuit breaker pattern. The new
DistributedCircuitBreaker
extends the existingCircuitBreaker
functionality by supporting any storage backend through a genericCacheClient
interface, enabling distributed state management across multiple instances of an application.Key Changes
DistributedCircuitBreaker[T]
struct that embeds the originalCircuitBreaker[T]
CacheClient
interface that can be implemented by any storage solution (Redis, Memcached, etcd, etc.)StorageSettings
to configure the distributed circuit breakerStoredState
struct to represent the circuit breaker state in the storage backendFeatures
Storage Flexibility
CacheClient
interfaceDesign Considerations
GetState
andSetState
methodsT
maintains type safety for the protected operation's resultNext Steps
This enhancement makes our circuit breaker implementation more flexible and adaptable to different distributed storage requirements while maintaining its core functionality and reliability.