Skip to content
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

fix: add default impl for StateChangeListener #134

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sentinel-core/src/core/circuitbreaker/breaker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,23 @@
/// on_transform_to_closed is triggered when circuit breaker state transformed to Closed.
/// Argument rule is copy from circuit breaker's rule, any changes of rule don't take effect for circuit breaker
/// Copying rule has a performance penalty and avoids invalid listeners as much as possible
fn on_transform_to_closed(&self, prev: State, rule: Arc<Rule>);
fn on_transform_to_closed(&self, prev: State, rule: Arc<Rule>) {}

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 92 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

/// `on_transform_to_open` is triggered when circuit breaker state transformed to Open.
/// The "snapshot" indicates the triggered value when the transformation occurs.
/// Argument rule is copy from circuit breaker's rule, any changes of rule don't take effect for circuit breaker
/// Copying rule has a performance penalty and avoids invalid listeners as much as possible
fn on_transform_to_open(&self, prev: State, rule: Arc<Rule>, snapshot: Option<Arc<Snapshot>>);
fn on_transform_to_open(&self, prev: State, rule: Arc<Rule>, snapshot: Option<Arc<Snapshot>>) {}

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `snapshot`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 98 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `snapshot`

/// `on_transform_to_half_open` is triggered when circuit breaker state transformed to HalfOpen.
/// Argument rule is copy from circuit breaker's rule, any changes of rule don't take effect for circuit breaker
/// Copying rule has a performance penalty and avoids invalid listeners as much as possible
fn on_transform_to_half_open(&self, prev: State, rule: Arc<Rule>);
fn on_transform_to_half_open(&self, prev: State, rule: Arc<Rule>) {}

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 103 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

/// `on_circuit_breaker_drop` is triggered when circuit breaker is drop.
/// Argument rule is copy from circuit breaker's rule, any changes of rule don't take effect for circuit breaker
/// Copying rule has a performance penalty and avoids invalid listeners as much as possible
fn on_circuit_breaker_drop(&self, prev: State, rule: Arc<Rule>);
fn on_circuit_breaker_drop(&self, prev: State, rule: Arc<Rule>) {}

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / WebAssembly

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / CI (ubuntu-latest)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (macos-latest, x86_64-apple-darwin)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `prev`

Check warning on line 108 in sentinel-core/src/core/circuitbreaker/breaker/mod.rs

View workflow job for this annotation

GitHub Actions / Platforms (windows-latest, x86_64-pc-windows-msvc)

unused variable: `rule`
}

/// `CircuitBreakerTrait` is the basic trait of circuit breaker
Expand Down
Loading