-
Notifications
You must be signed in to change notification settings - Fork 556
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
feat: Exit while cache is not configured correctly #1515
Conversation
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Codecov ReportBase: 30.15% // Head: 30.12% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1515 +/- ##
==========================================
- Coverage 30.15% 30.12% -0.04%
==========================================
Files 47 47
Lines 16665 16643 -22
Branches 7918 7908 -10
==========================================
- Hits 5026 5014 -12
+ Misses 6326 6315 -11
- Partials 5313 5314 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Fixed! @sylvestre PTAL. |
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
@@ -373,30 +382,31 @@ impl Storage for opendal::Operator { | |||
} | |||
|
|||
/// Normalize key `abcdef` into `a/b/c/abcdef` | |||
#[allow(dead_code)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be removed altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will be used if feature like s3
, azure
enabled. Adding a dead_code
is the most simple way to address clippy errors under --no-default-feature
.
@@ -666,7 +665,7 @@ fn config_file(env_var: &str, leaf: &str) -> PathBuf { | |||
|
|||
#[derive(Debug, Default, PartialEq, Eq)] | |||
pub struct Config { | |||
pub caches: Vec<CacheType>, | |||
pub cache: Option<CacheType>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this used anywhere before? Did multiple backends ever work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did multiple backends ever work?
No, they never works at the same time.
The only case is users configure different backends at the same time, and some of them are wrong. For example, users configure s3, azure, redis at the same time, and s3, azure is invalid, only redis works.
In old logic, the errors returned by s3 and azure will be ignore, and using redis finally. In this PR, we will only choose the first valid cache type and returns error happened which makes the behavior more predictable.
In the future, I will return errors if users configured different backends at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear whether the changes of many backends to one is diserable or not. If that checks out, looks good to me otherwise
Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
Signed-off-by: Xuanwo github@xuanwo.io
This PR is the first step of #1512.
We will exit while the cache is not configured correctly. For example, s3 is configured with an invalid endpoint.