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

Attribute object that supports units and comparison #4779

Merged
merged 4 commits into from
Oct 15, 2018
Merged

Conversation

dadgar
Copy link
Contributor

@dadgar dadgar commented Oct 12, 2018

Instead of fingerprinters emitting an opaque string, they can now emit a type attribute value. These attributes support a set of units as well. The attributes also support comparison, making the following possible:
10.5GiB < 12GB

// Multiplier is the multiplier over the base unit (KiB multiplier is 1024)
Multiplier int64

// InverseMultiplier specifies that the multiplier is an inverse so:
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make the multiplier a float so it works for both cases?

}

// comparitor returns the comparitor function for the attribute
func (a *Attribute) comparitor() compareFn {
Copy link
Contributor

@preetapan preetapan Oct 15, 2018

Choose a reason for hiding this comment

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

typo - comparator, here and in the various functions below

"100.25mW",
}

// run the Fib function b.N times
Copy link
Contributor

Choose a reason for hiding this comment

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

invalid comment

// lengthSortedUnits is a list of unit names sorted by length with longest
// first
lengthSortedUnits = make([]string, 0, numUnits)

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn;t check the conversion values below too closely, since there's no unit test and we are setting up the units here its worth a second look

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double checked them

Copy link
Contributor

@preetapan preetapan left a comment

Choose a reason for hiding this comment

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

Had some comments

@dadgar dadgar merged commit add43f9 into master Oct 15, 2018
@dadgar dadgar deleted the f-attributes-typed branch October 15, 2018 20:38
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants