Exemple #1
0
        public Task <IEnumerable <BlobMeta> > GetMetaAsync(IEnumerable <string> ids, CancellationToken cancellationToken)
        {
            GenericValidation.CheckBlobId(ids);

            var result = new List <BlobMeta>();

            foreach (string id in ids)
            {
                if (!_idToData.TryGetValue(id, out Tag tag))
                {
                    result.Add(null);
                }
                else
                {
                    var meta = new BlobMeta(tag.data.Length, tag.md5, tag.lastMod);

                    result.Add(meta);
                }
            }

            return(Task.FromResult <IEnumerable <BlobMeta> >(result));
        }
        public Task <IEnumerable <BlobMeta> > GetMetaAsync(IEnumerable <string> ids, CancellationToken cancellationToken)
        {
            GenericValidation.CheckBlobId(ids);

            var result = new List <BlobMeta>();

            foreach (string id in ids)
            {
                if (!_idToData.TryGetValue(id, out MemoryStream ms))
                {
                    result.Add(null);
                }
                else
                {
                    ms.Seek(0, SeekOrigin.Begin);

                    var meta = new BlobMeta(ms.Length, ms.GetHash(HashType.Md5));

                    result.Add(meta);
                }
            }

            return(Task.FromResult <IEnumerable <BlobMeta> >(result));
        }