Exportar (0) Imprimir
Expandir todo
Este tema aún no ha recibido ninguna valoración - Valorar este tema

CloudBlockBlob.PutBlockList (Método) (IEnumerable (Genérico))

Uploads a list of blocks to a new or existing blob.

Espacio de nombres: Microsoft.WindowsAzure.StorageClient
Ensamblado: Microsoft.WindowsAzure.StorageClient (en microsoft.windowsazure.storageclient.dll)
'Uso
Dim instance As CloudBlockBlob
Dim blockList As IEnumerable(Of String)

instance.PutBlockList(blockList)
'Declaración
Public Sub PutBlockList ( _
	blockList As IEnumerable(Of String) _
)
public void PutBlockList (
	IEnumerable<String> blockList
)
public function PutBlockList (
	blockList : IEnumerable<String>
)

Parámetros

blockList

An enumerable collection of block IDs, as base64-encoded strings.

The following code example writes a set of blocks to a block blob, then commits the blocks to create or update the blob.

static void BlockBlobUploadManyBlocks(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 block blob.
    CloudBlockBlob blob = blobClient.GetBlockBlobReference("mycontainer/myblockblob");

    //Create a list to hold the block list.
    var blockList = new List<string>();

    byte[] data = new byte[100];
    for (int x = 0; x < 5; x++)
    {
        //Write blocks to the blob.
        using (var stream = new MemoryStream(data))
        {
            //Create a block ID.
            var id = Convert.ToBase64String(Encoding.UTF8.GetBytes(x.ToString()));

            blob.PutBlock(id, stream, null);
        }
    }

    //Commit the block list to create or update the blob.
    blob.PutBlockList(blockList);
}

The PutBlockList method writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the service using PutBlock.

By calling PutBlockList, you can modify an existing blob by inserting, updating, or deleting individual blocks, without uploading the whole blob again. You can specify block IDs from both the current committed block list and the uncommitted block list to create a new blob or update the content of an existing blob. In this way you can update a blob by specifying a few new blocks from the uncommitted block list, and the rest from the committed block list, which are already part of the existing blob.

The maximum number of blocks that may be committed is 50,000, and the maximum size of a blob that may be committed via PutBlockList is 200 GB. The maximum number of uncommitted blocks that may be associated with a blob is 100,000, and the maximum size of the uncommitted block list is 400 GB.

When you call PutBlockList to update an existing blob, the blob's existing properties and metadata are overwritten. However, any existing snapshots are retained with the blob. You can use include an access condition to perform the operation only if a specified condition is met.

If PutBlockList fails due to a missing block, you will need to upload the missing block.

Any uncommitted blocks will be garbage collected if there are no successful calls to upload a block or commit the block list within a week following the last successful block upload. If the blob's contents are modified in some other way, any uncommitted blocks will be garbage collected.


Cualquier miembro estático público (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas de desarrollo

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

Plataformas de destino

¿Te ha resultado útil?
(Caracteres restantes: 1500)
Gracias por sus comentarios

Adiciones de comunidad

Mostrar:
© 2014 Microsoft. Reservados todos los derechos.