Example #1
0
        public BlobAttributes FetchAttributes(string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].FetchAttributes(blobName));
        }
Example #2
0
        public ICloudBlob GetBlobReferenceFromServer(CloudBlobContainer parent, string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].GetBlobReferenceFromServer(this, parent, blobName));
        }
Example #3
0
            public void ReleaseLease(string blobName, string leaseId)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404, "BlobNotFound");
                }

                _items[blobName].ReleaseLease(leaseId);
            }
Example #4
0
            public Stream OpenRead(string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404, "BlobNotFound");
                }

                return(new MemoryStream(_items[blobName].Contents, writable: false));
            }
Example #5
0
        public Stream OpenRead(string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].OpenRead(blobName));
        }
Example #6
0
        public CloudBlobStream OpenWriteBlock(string containerName, string blobName,
                                              IDictionary <string, string> metadata)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404, "ContainerNotFound");
            }

            return(_items[containerName].OpenWriteBlock(blobName, metadata));
        }
Example #7
0
            public ICloudBlob GetBlobReferenceFromServer(MemoryBlobStore store, CloudBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

                switch (blob.BlobType)
                {
                case StorageBlobType.BlockBlob:
                    return(new FakeStorageBlockBlob(store, blobName, parent));

                case StorageBlobType.PageBlob:
                    return(new FakeStoragePageBlob(store, blobName, parent));

                case StorageBlobType.AppendBlob:
                    return(new FakeStorageAppendBlob(store, blobName, parent));

                default:
                    throw new InvalidOperationException(string.Format("Type '{0}' is not supported.", blob.BlobType));
                }
            }