Jai Haridas Engineer Microsoft Corporation

Post on 12-Sep-2021

2 views 0 download

transcript

Jai Haridas

Engineer

Microsoft Corporation

2

3

4

Blobs

Drives

Tables – Provide structured storage. A Table is a set of entities, which contain a set of properties

Queues

6

7

\n \n

8

9

10

BlobContainerAccount

cohowinery

images

PIC01.JPG

PIC02.JPG

videos VID1.AVI

http://<account>.blob.core.windows.net/<container>/<blobname>

− PutBlob

− GetBlob

− DeleteBlob

− CopyBlob

− SnapshotBlob

− LeaseBlob

Cache-Control, Content-Encoding, Content-Type, etc

11

12

CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("CloudStorageAccount");

CloudBlobClient blobClient = new CloudBlobClient(account.BlobEndpoint, account.Credentials);

// Create ContainerCloudBlobContainer cloudContainer = blobClient.GetContainerReference(containerName);bool hasCreated = cloudContainer.CreateIfNotExist();

// Access Blob in the ContainerCloudBlob cloudBlob = cloudContainer.GetBlobReference(blobName);

//BlobRequestOptions has retry policy, timeout etc.BlobRequestOptions options = new BlobRequestOptions();

//Upload the local file to Blob servicecloudBlob.UploadFile(uploadFileName, options);

//Download to local file namecloudBlob.DownloadToFile(downloadFileName, options);

Blob Client Library Example

Two Types Of Blobs Under The Hood

blocks

pages

Block BlobStreaming Workload w/ Random Reads + Committed Writes

10 GB Movie

Windows Azure Storage

Blo

ck

Id

1B

lock

Id

2B

lock

Id

3

Blo

ck

Id

N

blobName = “blob.wmv”;PutBlock(blobName, blockId1, block1Bits);PutBlock(blobName, blockId2, block2Bits);…………PutBlock(blobName, blockIdN, blockNBits);PutBlockList(blobName,

blockId1, blockId2…,blockIdN);

blob.wmvblob.wmv

••

•• PutPage 512, 2048• PutPage 0, 1024• ClearPage 512, 1536• PutPage 2048,2560

• GetPageRange 0, 4096

• 0,512 1536,2560

• GetBlob 1000, 2048••

1536,2048

0

10 GB

10 G

B A

dd

ress S

pace

512

1024

1536

2048

2560

Microsoft Confidential 16

Shared Access Signature (SAS)

st=2009-11-07T08:49Z &se=2009-11-07T09:49Z&sr=c &sp=rw&sig=3OSeIHP8haK%2fle9%2bBK3BX1DsdMM%3d

https://cohowinery.blob.core.windows.net/images/pic1.jpg?

st=2009-11-07T08:49Z &se=2009-11-07T09:49Z &sr=c &sp=rw

&sig=3OSeIHP8haK%2fle9%2bBK3BX1DsdMM%3d

https://cohowinery.blob.core.windows.net/images/pic1.jpg?

si=foo

19

Permission Resource Supported Operations

Read Container Read properties, content and metadata for any

blob in container

Read Blob Read properties, content and metadata for

specified blob in container

Write Container Create/Update content, properties and

metadata for any blob in container. CANNOT

create containers

Write Blob Create/Update content, properties and

metadata for specified blob in container

Delete Container Delete any blob in container. CANNOT delete

container

Delete Blob Delete specified blob

List Container List blobs in container

20

Blob Client Library SAS ExampleCloudBlobContainer container = blobClient.GetContainerReference("testcontainer");container.CreateIfNotExist();

// Create a permission policy and store it in container using SetPermissionsBlobContainerPermissions blobPermissions = new BlobContainerPermissions();blobPermissions.SharedAccessPolicies.Add("mypolicy", new SharedAccessPolicy()

{ SharedAccessStartTime = DateTime.Now, SharedAccessExpiryTime = DateTime.Now.AddHours(10),Permissions = SharedAccessPermissions.Write

| SharedAccessPermissions.Read});

// Make it a private folderblobPermissions.PublicAccess = BlobContainerPublicAccessType.Off;container.SetPermissions(blobPermissions);

// Get SAS and share it with intended usersstring sas = container.GetSharedAccessSignature(new SharedAccessPolicy(), "mypolicy");

// Clients can utilize the sas in the following mannerCloudBlobClient sasBlobClient = new CloudBlobClient(

account.BlobEndpoint, new StorageCredentialsSharedAccessSignature(sas));

CloudBlob blob = sasBlobClient.GetBlobReference("testcontainer/test.txt");blob.UploadText("Hello SAS World");

21

http://<id>.vo.msecnd.net/

http://events.cohowinery.com/

http://account.blob.core.windows.net/

− Note

22

23

24

Table Storage Concepts

EntityTableAccount

cohowinery

customers

Name =…

Email = …

Name =…

Email = …

winephotos

Photo ID =…

Date =…

Photo ID =…

Date =…

Queue Storage Concepts

MessageQueueAccount

order processing

CustomerID

OrderID

http://....

CustomerID

OrderID

http://...

cohowinery

27

− Blobs

− Drives

− Tables

− Queues

28

http://www.microsoft.com/windowsazure/offers/

http://www.microsoft.com/windowsazure/

http://blogs.msdn.com/windowsazurestorage/

29

www.Microsoft.com/Events/Series/

30