Exemple #1
0
        /// <summary>
        /// Bulk adds download URIs to the cache.
        /// </summary>
        public void BulkAddDownloadUris(IDictionary <string, Uri> blobDownloadUris)
        {
            if (blobDownloadUris == null)
            {
                return;
            }

            foreach (var blobDownloadUri in blobDownloadUris)
            {
                AddDownloadUri(
                    BlobIdentifier.Deserialize(blobDownloadUri.Key).ToContentHash(),
                    new PreauthenticatedUri(blobDownloadUri.Value, EdgeType.Unknown)); // EdgeType value shouldn't matter because we don't use it.
            }
        }
Exemple #2
0
        /// <summary>
        /// Converts a ContentStore ContentHash to a BlobIdentifier.
        /// </summary>
        public static BlobIdentifier ToBlobIdentifier(this ContentHash contentHash)
        {
            switch (contentHash.HashType)
            {
            case HashType.Vso0:
            case HashType.Dedup64K:
            case HashType.Dedup1024K:
            case HashType.Murmur:
                return(BlobIdentifier.Deserialize(contentHash.ToHex()));

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