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

Add helper functions for ByteSizeValues of a given unit #63679

Conversation

benwtrent
Copy link
Member

As a developer that periodically worries about absolute sizes of bytes, I love our good ByteSizeValue abstractions + and the unit sizes.

But, I find the pattern new ByteSizeValue(<some long>, <some unit>).getBytes() frustrating.

This commit adds some simple convenience methods for each byte unit and constructing a ByteSizeValue of the given size for that unit.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Features)

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Oct 14, 2020
Copy link
Contributor

@danhermann danhermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benwtrent
Copy link
Member Author

run elasticsearch-ci/1

@benwtrent benwtrent merged commit 37b261b into elastic:master Oct 14, 2020
@benwtrent benwtrent deleted the feature/es-add-byte-size-value-helper-functions branch October 14, 2020 20:56
benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Oct 14, 2020
As a developer that periodically worries about absolute sizes of bytes, I love our good ByteSizeValue abstractions + and the unit sizes.

But, I find the pattern `new ByteSizeValue(<some long>, <some unit>).getBytes()` frustrating. 

This commit adds some simple convenience methods for each byte unit and constructing a ByteSizeValue of the given size for that unit.
benwtrent added a commit that referenced this pull request Oct 14, 2020
)

As a developer that periodically worries about absolute sizes of bytes, I love our good ByteSizeValue abstractions + and the unit sizes.

But, I find the pattern `new ByteSizeValue(<some long>, <some unit>).getBytes()` frustrating. 

This commit adds some simple convenience methods for each byte unit and constructing a ByteSizeValue of the given size for that unit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants