C# Класс azurecopy.AzureHandler

Наследование: IBlobHandler
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
AzureAccountKey string
client Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient

Private Properties

Свойство Тип Описание
GetBlobPrefixFromUrl string
ListVirtualDirectoryBlobs List
ParallelWriteBlockBlob void
ReadBlockBlob Blob
ReadPageBlob Blob
WriteBlockBlob void
WritePageBlob void

Открытые методы

Метод Описание
AzureHandler ( string url ) : System

base url is mandatory.

CreateCustomAzureClient ( string accountName, string accountKey ) : void

Used to overwrite the default azure client.

GetBaseUrl ( ) : string
GetBlobNameFromUrl ( string url ) : string

Gets blob name from the full url. URL format for Azure is: https://accountname.blob.core.windows.net/containername/blobname OR https://accountname.blob.core.windows.net/containername/virt1/virt2/blobname In the second case the TRUE blob name is still "virt1/virt2/blobname" but we'll be handling virtual directories in some fashion.

GetContainerNameFromUrl ( string url ) : string

Gets container name from the full url. URL format for Azure is: https://accountname.blob.core.windows.net/containername/blobname OR https://accountname.blob.core.windows.net/containername/virt1/virt2/blobname In the second case the TRUE blob name is still "virt1/virt2/blobname" but we'll be handling virtual directories in some fashion.

ListBlobsInContainer ( string containerName = null, string blobPrefix = null, bool debug = false ) : IEnumerable

Lists all blobs in a container. Can be supplied a blobPrefix which basically acts as virtual directory options. eg, if we have blobs called: "virt1/virt2/myblob" and "virt1/virt2/myblob2" Although the blob names are the complete strings mentioned above, we might like to think that the blobs are just called myblob and myblob2. We can supply a blobPrefix of "virt1/virt2/" which we can *think* of as a directory, but again, its just really a prefix behind the scenes. For other sytems (not Azure) the blobPrefix might be real directories.... will need to investigate

ListContainers ( string root ) : List

List containers from url.

MakeContainer ( string containerName ) : void

Make new Azure container. Assumption being last part of url is the new container.

MoveBlob ( string originContainer, string destinationContainer, string startBlobname ) : void

Move blob from one container to another.

OverrideConfiguration ( string>.Dictionary configuration ) : void

Override the configuration file.

ReadBlob ( string containerName, string blobName, string cacheFilePath = "" ) : Blob

Read blob.

WriteBlob ( string containerName, string blobName, Blob blob, int parallelUploadFactor = 1, int chunkSizeInMB = 4 ) : void

Write blob

Приватные методы

Метод Описание
GetBlobPrefixFromUrl ( string url ) : string
ListVirtualDirectoryBlobs ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobDirectory dir ) : List
ParallelWriteBlockBlob ( Stream stream, Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob blob, int parallelFactor, int chunkSizeInMB ) : void

Upload in parallel. If total size of file is smaller than chunkSize, then simply split length by parallel factor. FIXME: Need to retest this!!!

ReadBlockBlob ( ICloudBlob blobRef, string fileName = "" ) : Blob

Read block blob.

ReadPageBlob ( ICloudBlob blobRef, string fileName = "" ) : Blob

Read page blob.

WriteBlockBlob ( Stream stream, string blobName, Blob blob, Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, int parallelFactor = 1, int chunkSizeInMB = 2 ) : void

Write a block blob. Determines if should be parallel or not then calls "real" method.

WritePageBlob ( Stream stream, string blobName, Blob blob, Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container, int parallelFactor = 1, int chunkSizeInMB = 2 ) : void

Write page blob. Although concurrency params exist, does NOT do concurrent uploading yet.

Описание методов

AzureHandler() публичный Метод

base url is mandatory.
public AzureHandler ( string url ) : System
url string
Результат System

CreateCustomAzureClient() публичный Метод

Used to overwrite the default azure client.
public CreateCustomAzureClient ( string accountName, string accountKey ) : void
accountName string
accountKey string
Результат void

GetBaseUrl() публичный Метод

public GetBaseUrl ( ) : string
Результат string

GetBlobNameFromUrl() публичный Метод

Gets blob name from the full url. URL format for Azure is: https://accountname.blob.core.windows.net/containername/blobname OR https://accountname.blob.core.windows.net/containername/virt1/virt2/blobname In the second case the TRUE blob name is still "virt1/virt2/blobname" but we'll be handling virtual directories in some fashion.
public GetBlobNameFromUrl ( string url ) : string
url string
Результат string

GetContainerNameFromUrl() публичный Метод

Gets container name from the full url. URL format for Azure is: https://accountname.blob.core.windows.net/containername/blobname OR https://accountname.blob.core.windows.net/containername/virt1/virt2/blobname In the second case the TRUE blob name is still "virt1/virt2/blobname" but we'll be handling virtual directories in some fashion.
public GetContainerNameFromUrl ( string url ) : string
url string
Результат string

ListBlobsInContainer() публичный Метод

Lists all blobs in a container. Can be supplied a blobPrefix which basically acts as virtual directory options. eg, if we have blobs called: "virt1/virt2/myblob" and "virt1/virt2/myblob2" Although the blob names are the complete strings mentioned above, we might like to think that the blobs are just called myblob and myblob2. We can supply a blobPrefix of "virt1/virt2/" which we can *think* of as a directory, but again, its just really a prefix behind the scenes. For other sytems (not Azure) the blobPrefix might be real directories.... will need to investigate
public ListBlobsInContainer ( string containerName = null, string blobPrefix = null, bool debug = false ) : IEnumerable
containerName string
blobPrefix string
debug bool
Результат IEnumerable

ListContainers() публичный Метод

List containers from url.
public ListContainers ( string root ) : List
root string
Результат List

MakeContainer() публичный Метод

Make new Azure container. Assumption being last part of url is the new container.
public MakeContainer ( string containerName ) : void
containerName string
Результат void

MoveBlob() публичный Метод

Move blob from one container to another.
public MoveBlob ( string originContainer, string destinationContainer, string startBlobname ) : void
originContainer string
destinationContainer string
startBlobname string
Результат void

OverrideConfiguration() публичный Метод

Override the configuration file.
public OverrideConfiguration ( string>.Dictionary configuration ) : void
configuration string>.Dictionary
Результат void

ReadBlob() публичный Метод

Read blob.
public ReadBlob ( string containerName, string blobName, string cacheFilePath = "" ) : Blob
containerName string
blobName string
cacheFilePath string
Результат Blob

WriteBlob() публичный Метод

Write blob
public WriteBlob ( string containerName, string blobName, Blob blob, int parallelUploadFactor = 1, int chunkSizeInMB = 4 ) : void
containerName string
blobName string
blob Blob
parallelUploadFactor int
chunkSizeInMB int
Результат void

Описание свойств

AzureAccountKey публичное статическое свойство

public static string AzureAccountKey
Результат string

client публичное свойство

public CloudBlobClient,Microsoft.WindowsAzure.Storage.Blob client
Результат Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient