예제 #1
0
            public ICloudBlob GetBlobReferenceFromServer(MemoryBlobStore store, FakeStorageBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

                if (blob._hook != null)
                {
                    return(blob._hook);
                }

                FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                {
                    ETag         = blob.ETag,
                    LastModified = blob.LastModified,
                };

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

                case BlobType.PageBlob:
                    return(new FakeStoragePageBlob(blobName, parent, properties));

                case BlobType.AppendBlob:
                    return(new FakeStorageAppendBlob(blobName, parent, properties));

                default:
                    throw new InvalidOperationException(string.Format("Type '{0}' is not supported.", blob.BlobType));
                }
            }
예제 #2
0
        public ICloudBlob GetBlobReferenceFromServer(FakeStorageBlobContainer parent, string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].GetBlobReferenceFromServer(this, parent, blobName));
        }
예제 #3
0
        public BlobAttributes FetchAttributes(string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].FetchAttributes(blobName));
        }
예제 #4
0
            public void ReleaseLease(string blobName, string leaseId)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404, "BlobNotFound");
                }

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

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

            return(_items[containerName].OpenRead(blobName));
        }
예제 #7
0
        public void AddMessage(string queueName, CloudQueueMessage message)
        {
            if (!_items.ContainsKey(queueName))
            {
                throw StorageExceptionFactory.Create(404, "QueueNotFound");
            }

            _items[queueName].AddMessage(message);
        }
예제 #8
0
        public IList <TableResult> ExecuteBatch(string tableName, TableBatchOperation batch)
        {
            if (!_items.ContainsKey(tableName))
            {
                throw StorageExceptionFactory.Create(404, "TableNotFound");
            }

            return(_items[tableName].ExecuteBatch(batch));
        }
예제 #9
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));
        }