Use structured proto types for Hash, Signature, and ContentAddress #1726
Merged
Conversation
Replace stringly-typed fields in `store.proto` with proper message types: - `Hash` — algorithm enum + raw digest bytes - `Signature` — key name + signature string - `ContentAddress` — method enum + hash `UnkeyedValidPathInfo.nar_hash` is now `Hash` (not string), `signatures` is `repeated Signature` (not `repeated string`), `ca` is `optional ContentAddress` (not `optional string`). `UnkeyedNarInfo.file_hash`/`file_size` renamed to `download_hash`/`download_size` with proper `Hash` type. All `From`/`TryFrom` impls use `&` for harmonia→proto direction (no need to consume the source) and by-value for proto→harmonia (proto types are consumed). Round-trip tests cover every layer.
27f4f8b to
ac3bf83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace stringly-typed fields in
store.protowith proper message types:Hash— algorithm enum + raw digest bytesSignature— key name + signature stringContentAddress— method enum + hashUnkeyedValidPathInfo.nar_hashis nowHash(not string),signaturesisrepeated Signature(notrepeated string),caisoptional ContentAddress(notoptional string).UnkeyedNarInfo.file_hash/file_sizerenamed todownload_hash/download_sizewith properHashtype.All
From/TryFromimpls use&for harmonia→proto direction(no need to consume the source) and by-value for proto→harmonia
(proto types are consumed). Round-trip tests cover every layer.