-
Notifications
You must be signed in to change notification settings - Fork 15
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: Add support for human-readable duration formats #647
Conversation
In its current form, the There currently is an open issue upstream in |
Constant values are now possible: use stackable_operator::duration::Duration;
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(3600); |
This reworks/simplifies the `Duration` implementation. Supported units are now clearly defned by an enum and the parsing/display mechanism is now way more explicit and defined in one place. Co-authored-by: Natalie Klestrup Röijezon <teo.roijezon@stackable.de>
Co-authored-by: Natalie Klestrup Röijezon <teo.roijezon@stackable.de>
Co-authored-by: Natalie Klestrup Röijezon <teo.roijezon@stackable.de>
This commit now parses durations in the Go format. This format doesn't use whitespaces to separate each fragment. Instead, all fragments are concated without any space between. The parser needs to be a little cleverer when trying to keep it streamlined. Additionally, the error variants now contain some more context to make it easier for the user to spot the error in the provided value. Co-authored-by: Natalie Klestrup Röijezon <teo.roijezon@stackable.de>
Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
Commit fe1911e breaks |
…alid character" This reverts commit fe1911e.
Actual change LGTM, giving it a try with trino-op graceful shutdown |
|
Looking at the generated
|
@Techassi as discussed, pushed the fixes, please have a look |
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.
Tested and works fine for the trino graceful shutdown, awesome!
However, I would give @nightkr the chance to review the code again
Yes, looks good! Waiting for final feedback from @nightkr |
Fair, I should have fixed those test cases. |
…ever a valid character"" This reverts commit 2d3d32c.
… into feat/humantime
Awesome, thanks for working on this! |
Fixes #649. This was discussed in an arch meeting roughly two weeks ago (when this PR was opened).
It is part of the effort to unify duration formats used in our CRDs. Operators would need to use the exported
Duration
type to support human-readable duration formats. This PR adds support for human-readable durations, like2d2h20m42s
or15d2m2s
. TheDuration
type requirements are tracked in #649These changes are breaking, because:
number
tostring
string
is already used, the parsing might be slightly differentAuthor
Reviewer