Esporta (0) Stampa
Espandi tutto

Metodo CloudBlob.CreateSnapshot ()

Creates a snapshot of the blob.

Spazio dei nomi: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in microsoft.windowsazure.storageclient.dll)

Dim instance As CloudBlob
Dim returnValue As CloudBlob

returnValue = instance.CreateSnapshot

CloudBlob^ CreateSnapshot ()
public CloudBlob CreateSnapshot ()
public function CreateSnapshot () : CloudBlob

Valore restituito

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.

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.

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.

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.

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme di sviluppo

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

Piattaforme di destinazione

Aggiunte alla community

Microsoft sta conducendo un sondaggio in linea per comprendere l'opinione degli utenti in merito al sito Web di MSDN. Se si sceglie di partecipare, quando si lascia il sito Web di MSDN verrà visualizzato il sondaggio in linea.

Si desidera partecipare?
© 2014 Microsoft