Beispiel #1
0
 public static Xldb.Proto.ContentHash ToContentHash(this ContentHash contentHash)
 {
     return(new Xldb.Proto.ContentHash()
     {
         Value = Google.Protobuf.ByteString.CopyFrom(contentHash.ToHashByteArray()),
         HashType = contentHash.HashType == Cache.ContentStore.Hashing.HashType.DeprecatedVso0 ? Xldb.Proto.HashType.DeprecatedVso0 : (Xldb.Proto.HashType)(contentHash.HashType + 1),
     });
 }
Beispiel #2
0
        private static BlobIdentifier ContentHashToBlobIdentifier(BuildXL.Cache.ContentStore.Hashing.ContentHash contentHash)
        {
            switch (contentHash.HashType)
            {
            case BuildXL.Cache.ContentStore.Hashing.HashType.Vso0:
            case BuildXL.Cache.ContentStore.Hashing.HashType.Dedup64K:
            case BuildXL.Cache.ContentStore.Hashing.HashType.Dedup1024K:
            case BuildXL.Cache.ContentStore.Hashing.HashType.Murmur:
                return(new BlobIdentifier(contentHash.ToHashByteArray()));

            case BuildXL.Cache.ContentStore.Hashing.HashType.DedupSingleChunk:
                return(new ChunkDedupIdentifier(contentHash.ToHashByteArray()).ToBlobIdentifier());

            case BuildXL.Cache.ContentStore.Hashing.HashType.DedupNode:
                return(new NodeDedupIdentifier(contentHash.ToHashByteArray()).ToBlobIdentifier());

            default:
                throw new ArgumentException($"ContentHash has unsupported type when converting to BlobIdentifier: {contentHash.HashType}");
            }
        }