내보내기(0) 인쇄
모두 확장

CloudBlob.CreateSnapshot 메서드 (BlobRequestOptions)

Creates a snapshot of the blob.

네임스페이스: Microsoft.WindowsAzure.StorageClient
어셈블리: Microsoft.WindowsAzure.StorageClient(microsoft.windowsazure.storageclient.dll)

‘사용 방법
Dim instance As CloudBlob
Dim options As BlobRequestOptions
Dim returnValue As CloudBlob

returnValue = instance.CreateSnapshot(options)

‘선언
Public Function CreateSnapshot ( _
	options As BlobRequestOptions _
) As CloudBlob
public CloudBlob CreateSnapshot (
	BlobRequestOptions options
)
public function CreateSnapshot (
	options : BlobRequestOptions
) : CloudBlob

매개 변수

options

An object that specifies any additional options for the request.

반환 값

A blob snapshot.

static void CreateBlobSnapshot(Uri blobEndpoint, string accountName, string accountKey)
{
    //Create service client for credentialed access to the Blob service.
    CloudBlobClient blobClient = new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));

    //Get a reference to a blob.
    CloudBlob blob = blobClient.GetBlobReference("mycontainer/myblob.txt");

    //Take a snapshot of the blob.
    CloudBlob snapshot = blob.CreateSnapshot();

    //Get the snapshot timestamp.
    DateTime timestamp = (DateTime)snapshot.Attributes.Snapshot;

    //Use the timestamp to get a second reference to the snapshot.
    CloudBlob snapshot2 = new CloudBlob("mycontainer/myblob.txt", timestamp, blobClient);

    //Write out the snapshot URI.
    Console.WriteLine(snapshot2.Uri);
}

Snapshots provide read-only versions of blobs. Once a snapshot has been created, it can be read, copied, or deleted, but not modified.

A snapshot is itself a blob, and can be represented by a CloudBlob object or one of its derived objects.

When you create a snapshot, the blob's Snapshot property returns a DateTime value that uniquely identifies the snapshot relative to its base blob. You can use this value to perform further operations on the snapshot. Note that this DateTime value is opaque.

You can use a snapshot to restore a blob to an earlier version by copying over a base blob with its snapshot.

note참고
You are charged for unique blocks or pages stored in association with a blob. Creating a snapshot does not incur an additional charge against your storage account for blocks or pages used, as the snapshot does not use additional storage resources but instead shares blocks or pages with the base blob, as long as they remain identical. As you add new blocks or pages to the base blob, you are charged for the storage capacity used by these new blocks or pages.

Copying Blob Properties and Metadata

When you create a snapshot of a blob, the following system properties are copied to the snapshot with the same values:

The base blob's committed block list is also copied to the snapshot, if the blob is a block blob. Any uncommitted blocks are not copied.

The metadata associated with the base blob is copied to the snapshot.

Specifying an Access Condition

You can specify an access condition so that the snapshot is created only if a condition is met. To specify an access condition, use the AccessCondition property. If the specified condition is not met, the snapshot is not created, and the Blob service returns status code HTTPStatusCode.PreconditionFailed.

Copying Snapshots

When a base blob is copied, any snapshots of the base blob are not copied to the destination blob. When a destination blob is overwritten with a copy, any snapshots associated with the destination blob stay intact under its name.

You can copy a snapshot blob over its base blob to restore an earlier version of a blob. The snapshot remains, but the base blob is overwritten with a copy that can be both read and written.

note참고
Promoting a snapshot in this way does not incur an additional charge for storage resources, since blocks or pages are shared between the snapshot and the base blob.


이 형식의 모든 public static(Shared, Visual Basic의 경우) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

개발 플랫폼

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 및 Windows 2000

대상 플랫폼

커뮤니티 추가 항목

표시:
© 2014 Microsoft