Skip to content

Commit

Permalink
feat(serving): add Hash to FileInfo protos (#5207)
Browse files Browse the repository at this point in the history
Support having a hash of each file in the xrefs server used potentially
for patching.
  • Loading branch information
schroederc committed Feb 3, 2022
1 parent 63bc29e commit dd53bcd
Show file tree
Hide file tree
Showing 4 changed files with 446 additions and 283 deletions.
19 changes: 19 additions & 0 deletions kythe/proto/common.proto
Expand Up @@ -204,3 +204,22 @@ message Language {
// Set of analyzer versions used for this language's analysis.
repeated string analyzer_version = 3;
}

// A Hash of some data.
message Hash {
// Specifies the hash algorithm, if any.
enum HashType {
NONE = 0;

// Use a sha256 hash (git's successor hash --
// https://git-scm.com/docs/hash-function-transition/).
SHA256 = 1;
// Use a sha1 hash (git's legacy blob hash).
SHA1 = 2;
}

// The type of hash that was performed.
HashType type = 1;
// The hash value.
bytes value = 2;
}
199 changes: 163 additions & 36 deletions kythe/proto/common_go_proto/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions kythe/proto/serving.proto
Expand Up @@ -182,6 +182,10 @@ message FileInfo {
kythe.proto.common.CorpusPath corpus_path = 1;

string revision = 2;

// Hash of the file contents; the algorithm of the hash may differ between
// corpora based on the repository from which they were extracted.
kythe.proto.common.Hash hash = 3;
}

// FileDecorations stores a file's contents and all contained anchor edges.
Expand Down

0 comments on commit dd53bcd

Please sign in to comment.