匯出 (0) 列印
全部展開
EN
本內容沒有您的語言版本,但有英文版本。
1 人當中有 0 人評分為有幫助- 為這個主題評分

CloudBlockBlob.PutBlock Method

Updated: October 23, 2013

[This topic is part of the Windows Azure Storage Client Library 2.1. The current recommended version is Storage Client Library 3.0.]

Uploads a single block.

Namespace: Microsoft.WindowsAzure.Storage.Blob
Assembly: Microsoft.WindowsAzure.Storage (in Microsoft.WindowsAzure.Storage.dll)
'用途
Dim instance As CloudBlockBlob
Dim blockId As String
Dim blockData As Stream
Dim contentMD5 As String
Dim accessCondition As AccessCondition
Dim options As BlobRequestOptions
Dim operationContext As OperationContext

instance.PutBlock(blockId, blockData, contentMD5, accessCondition, options, operationContext)
[DoesServiceRequest] 
public void PutBlock (
	string blockId,
	Stream blockData,
	string contentMD5,
	[OptionalAttribute] AccessCondition accessCondition,
	[OptionalAttribute] BlobRequestOptions options,
	[OptionalAttribute] OperationContext operationContext
)

Parameters

blockId

A base64-encoded block ID that identifies the block.

blockData

A stream that provides the data for the block.

contentMD5

An optional hash value that will be used to set the ContentMD5 property on the blob. May be null or an empty string.

accessCondition

An AccessCondition object that represents the access conditions for the blob. If null, no condition is used.

options

A BlobRequestOptions object that specifies any additional options for the request.

operationContext

An OperationContext object that represents the context for the current operation.

The PutBlock method uploads a block for future inclusion in a block blob. A block may be up to 4 MB in size.

After you have uploaded a set of blocks, you can create or update the blob on the server from this set by calling the PutBlockList method. Each block in the set is identified by a block ID that is unique within that blob. Block IDs are scoped to a particular blob, so different blobs can have blocks with same IDs.

If you call PutBlock on a blob that does not yet exist, a new block blob is created with a content length of 0. This blob is enumerated by a blob listing operation if the UncommittedBlobs option is specified. The block or blocks that you uploaded are not committed until you commit the block list for the new blob. A blob created this way is maintained on the server for a week; if you have not added more blocks or committed blocks to the blob within that time period, then the blob is garbage collected.

The maximum block blob size currently supported is 200 GB, and up to 50,000 blocks. A blob can have a maximum of 100,000 uncommitted blocks at any given time, and the set of uncommitted blocks cannot exceed 400 GB in total size.

A block that has been successfully uploaded does not become part of a blob until it is committed with a call to PutBlockList. Before the block list is committed to create a new blob or update an existing blob, an operation to return the blob's contents does not include the contents of the uncommitted block.

If you upload a block that has the same block ID as another block that has not yet been committed, the last uploaded block with that ID will be committed on the next successful call to PutBlockList.

On calling PutBlockList, all uncommitted blocks specified in the block list are committed as part of the new blob. Any uncommitted blocks that were not specified in the block list for the blob will be garbage collected and removed from the Blob service. Any uncommitted blocks will also be garbage collected if they are not committed within a week following the last successful block upload. If another write operation is performed on the blob, any uncommitted blocks will also be garbage collected.

For a given blob, all block IDs must be the same length, but the block contents can be of different size. For a given blob, all block IDs must be the same length. If a block is uploaded with a block ID of a different length than the block IDs for any existing uncommitted blocks, an exception is thrown, with an error code of InvalidBlockId.

Calling PutBlock does not update the last modified time of an existing blob.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7 and Windows Server 2008

 

本文對您有任何幫助嗎?
(剩餘 1500 個字元)
感謝您提供意見
顯示:
© 2014 Microsoft. 著作權所有,並保留一切權利。