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

Cleanup digest function to use u64 instead of i64 #1327

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

allada
Copy link
Member

@allada allada commented Sep 6, 2024

It is weird that we use i64 in the code base for this in the first place. There is some historical reason for having it this way, specifically around keeping it in sync with the Digest proto, but once converted we don't need to do this.

Also implement a more standard format/display function for DigestInfo using the common '{hash}-{size}' format.

Removes direct access to modify the internals of DigestInfo and requires member access to go through accessors.


This change is Reviewable

Copy link
Member Author

@allada allada left a comment

Choose a reason for hiding this comment

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

+@adam-singer

Reviewable status: 0 of 1 LGTMs obtained, and 0 of 24 files reviewed, and pending CI: Analyze (javascript-typescript), Analyze (python), Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Installation / macos-14, Installation / ubuntu-22.04, Local / ubuntu-22.04, NativeLink.com Cloud / Remote Cache (Legacy Dockerfile Test), Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (22.04), integration-tests (22.04), macos-13, pre-commit-checks, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, vale, windows-2022 / stable (waiting on @adam-singer)

Copy link
Contributor

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 24 of 24 files at r1, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Local / ubuntu-22.04, NativeLink.com Cloud / Remote Cache (Legacy Dockerfile Test), Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (22.04), macos-13, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable

Copy link
Member

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 11 of 24 files at r1, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, NativeLink.com Cloud / Remote Cache (Legacy Dockerfile Test), Remote / large-ubuntu-22.04, asan / ubuntu-22.04, docker-compose-compiles-nativelink (22.04), macos-13, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, and 1 discussions need to be resolved


nativelink-util/src/common.rs line 176 at r1 (raw file):

                // This is a placeholder value that can help a user identify
                // that the conversion failed.
                -255

nit: seems hacky

Copy link
Member Author

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, NativeLink.com Cloud / Remote Cache (Legacy Dockerfile Test), asan / ubuntu-22.04, docker-compose-compiles-nativelink (22.04), macos-13, ubuntu-20.04 / stable, ubuntu-22.04, ubuntu-22.04 / stable, windows-2022 / stable, and 1 discussions need to be resolved


nativelink-util/src/common.rs line 176 at r1 (raw file):

Previously, aaronmondal (Aaron Siddhartha Mondal) wrote…

nit: seems hacky

Yeah. I started to do a TryFrom, but it quickly got out of hand.

It is weird that we use i64 in the code base for this in the first
place. There is some historical reason for having it this way,
specifically around keeping it in sync with the Digest proto, but once
converted we don't need to do this.

Also implement a more standard format/display function for DigestInfo
using the common '{hash}-{size}' format.

Removes direct access to modify the internals of DigestInfo and requires
member access to go through accessors.
Copy link
Member

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 7 of 7 files at r2, all commit messages.
Reviewable status: 1 of 1 LGTMs obtained, and all files reviewed, and pending CI: windows-2022 / stable

@allada allada merged commit 140b7cb into TraceMachina:main Sep 6, 2024
28 checks passed
@allada allada deleted the digest-function-cleanup branch September 6, 2024 17:04
bclark8923 pushed a commit to bclark8923/nativelink that referenced this pull request Sep 6, 2024
It is weird that we use i64 in the code base for this in the first
place. There is some historical reason for having it this way,
specifically around keeping it in sync with the Digest proto, but once
converted we don't need to do this.

Also implement a more standard format/display function for DigestInfo
using the common '{hash}-{size}' format.

Removes direct access to modify the internals of DigestInfo and requires
member access to go through accessors.
bclark8923 pushed a commit to bclark8923/nativelink that referenced this pull request Sep 6, 2024
It is weird that we use i64 in the code base for this in the first
place. There is some historical reason for having it this way,
specifically around keeping it in sync with the Digest proto, but once
converted we don't need to do this.

Also implement a more standard format/display function for DigestInfo
using the common '{hash}-{size}' format.

Removes direct access to modify the internals of DigestInfo and requires
member access to go through accessors.
bclark8923 pushed a commit to bclark8923/nativelink that referenced this pull request Sep 6, 2024
It is weird that we use i64 in the code base for this in the first
place. There is some historical reason for having it this way,
specifically around keeping it in sync with the Digest proto, but once
converted we don't need to do this.

Also implement a more standard format/display function for DigestInfo
using the common '{hash}-{size}' format.

Removes direct access to modify the internals of DigestInfo and requires
member access to go through accessors.
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.

3 participants