Пример #1
0
        public IIndexedBlob ImportBlob(CloudBlockBlob sourceBlob, IndexedBlobStorageOptions options = null, Dictionary <string, string> properties = null)
        {
            options = EnsureOptions(options);
            sourceBlob.FetchAttributes();
            var fileKey = string.Format("{0}-{1}", sourceBlob.Uri.LocalPath.Replace("/", "-"), sourceBlob.Properties.ETag);

            return(ImportBlob(fileKey, sourceBlob, options, properties));
        }
Пример #2
0
        public IIndexedBlob CreateIndexedBlob(string fileName, Stream stream, IndexedBlobStorageOptions options = null, Dictionary <string, string> properties = null)
        {
            options = EnsureOptions(options);

            var key = options.FileKeyGenerator.GenerateKey(fileName, stream);

            return(CreateIndexedBlob(fileName, key, stream, options, properties));
        }
Пример #3
0
 protected CloudIndexedBlob(string fileKey, IndexedBlobEntity entity, IndexedBlobStorageOptions options, CloudIndexedBlobStore cloudIndexedBlobStore, Dictionary <string, string> properties)
 {
     _properties    = properties != null ? new Dictionary <string, string>(properties) : new Dictionary <string, string>();
     FileKey        = fileKey;
     Exists         = entity != null;
     _blobCount     = entity != null ? entity.BlobCount : options.AdditionalBlobsForLoadBalancing + 1;
     Length         = entity != null ? entity.Length : 0;
     _propertyCount = entity != null ? entity.PropertyCount : _properties.Count;
     Options        = options;
     Store          = cloudIndexedBlobStore;
 }
Пример #4
0
        public IIndexedBlob ImportBlob(string fileKey, CloudBlockBlob sourceBlob, IndexedBlobStorageOptions options = null, Dictionary <string, string> properties = null)
        {
            options = EnsureOptions(options);

            var indexRecord = LookupIndexedBlob(fileKey);

            if (options.UseBlobCopyAccrossStorageAccounts || sourceBlob.ServiceClient.Credentials.AccountName == _store.Container.ServiceClient.Credentials.AccountName)
            {
                return(new CopyableIndexedBlob(sourceBlob, fileKey, indexRecord, options, _store, properties));
            }

            return(new DownloadUploadImportBlob(sourceBlob, fileKey, indexRecord, options, _store, properties));
        }
Пример #5
0
 public CopyableIndexedBlob(CloudBlockBlob sourceBlob, string fileKey, IndexedBlobEntity entity, IndexedBlobStorageOptions options, CloudIndexedBlobStore cloudIndexedBlobStore, Dictionary <string, string> properties)
     : base(fileKey, entity, options, cloudIndexedBlobStore, properties)
 {
     _sourceBlob = sourceBlob;
     if (sourceBlob.Properties.Length == 0)
     {
         sourceBlob.FetchAttributes();
     }
     Length   = sourceBlob.Properties.Length;
     FileName = sourceBlob.Name;
 }
        public DownloadUploadImportBlob(CloudBlockBlob sourceBlob, string fileKey, IndexedBlobEntity indexRecord, IndexedBlobStorageOptions options, CloudIndexedBlobStore store, Dictionary <string, string> properties)
            : base(fileKey, indexRecord, options, store, properties)
        {
            _sourceBlob = sourceBlob;

            if (sourceBlob.Properties.Length == 0)
            {
                sourceBlob.FetchAttributes();
            }
            Length   = sourceBlob.Properties.Length;
            FileName = sourceBlob.Name;
        }
Пример #7
0
 IndexedBlobStorageOptions EnsureOptions(IndexedBlobStorageOptions options)
 {
     return(options ?? (DefaultStorageOptions));
 }
Пример #8
0
        public IIndexedBlob CreateIndexedBlob(string fileName, string fileKey, Stream stream, IndexedBlobStorageOptions options = null, Dictionary <string, string> properties = null)
        {
            options = EnsureOptions(options);

            var indexRecord = LookupIndexedBlob(fileKey);

            return(new UploadableIndexedBlob(fileName, stream, fileKey, indexRecord, options, _store, properties));
        }
Пример #9
0
 internal IndexedBlobStoreClient(CloudIndexedBlobStore store)
 {
     _store = store;
     DefaultStorageOptions = new IndexedBlobStorageOptions();
     DefaultReadOptions    = new IndexedBlobReadOptions();
 }
 public UploadableIndexedBlob(string fileName, Stream stream, string fileKey, IndexedBlobEntity indexedBlobEntity, IndexedBlobStorageOptions options, CloudIndexedBlobStore cloudIndexedBlobStore, Dictionary <string, string> properties)
     : base(fileKey, indexedBlobEntity, options, cloudIndexedBlobStore, properties)
 {
     Length   = stream.Length;
     _stream  = stream;
     FileName = fileName;
 }