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

Revise DataSize & DataRate #481

Merged
merged 19 commits into from
Jul 18, 2022
Merged

Conversation

garyparrot
Copy link
Collaborator

@garyparrot garyparrot commented Jul 15, 2022

  • Add the following utils.
    • DataSize#add(long bytes), add by an amount of byte
    • DataSize#subtract(long bytes), subtract by an amount of byte
    • DataSize#bytes(), a way to get bytes from DataSize, might overflow tho.
    • DataSize#perSecond(), a way to convert data size to data rate
    • DataRate#doubleByteRate(), a way to convert DataRate to bytes/second in double
    • DataRate#longByteRate(), a way to convert DataRate to bytes/second in long
    • DataRate#dataSize(), a way to convert DataRate to size per second
    • DataRate.fromDouble(), a way to convert a double measurement with byte/second as unit to DataRate
    • DataRate.fromLong(), a way to convert a long measurement with byte/second as unit to DataRate
    • DataSize.ZERO, zero byte, useful for Stream#reduce related operation.
  • improve the precision of unit conversion.

* `DataSize#add(long bytes)`, add by an amount of byte
* `DataSize#subtract(long bytes)`, subtract by an amount of byte
* `DataSize#bytes()`, a way to get bytes from DataSize, might overflow tho.
* `DataSize#perSecond()`, a way to convert data size to data rate
* `DataRate#doubleByteRate()`, a way to convert DataRate to bytes/second in double
* `DataRate#longByteRate()`, a way to convert DataRate to bytes/second in long
* `DataRate#dataSize()`, a way to convert DataRate to size per second
* `DataRate.fromDouble()`, a way to convert a double measurement with byte/second as unit to DataRate
* `DataRate.fromLong()`, a way to convert a long measurement with byte/second as unit to DataRate
Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@garyparrot 感謝嘗試重構,底下有幾個問題跟PR無關,但都跟重構DataSize and DataRate有關

1. add `DataRate.ZERO`
2. add `DataRate.Size.of()`
3. remove `DataRate.of(...)`
# Conflicts:
#	app/src/main/java/org/astraea/app/performance/Manager.java
#	app/src/main/java/org/astraea/app/performance/Performance.java
#	app/src/test/java/org/astraea/app/performance/DataSupplierTest.java
Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@garyparrot 感謝更新,還有幾個疑問請看一下

@chia7712 chia7712 merged commit 71df382 into opensource4you:main Jul 18, 2022
@chia7712
Copy link
Contributor

@garyparrot 感謝完成重構,期待其他PR也能有如此高水準的表現

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants