PageBlobClient
The PageBlobClient allows you to manipulate Azure
Storage page blobs.
Page blobs are a collection of 512-byte pages optimized for random
read and write operations. To create a page blob, you initialize the
page blob and specify the maximum size the page blob will grow. To add
or update the contents of a page blob, you write a page or pages by
specifying an offset and a range that align to 512-byte page
boundaries. A write to a page blob can overwrite just one page, some
pages, or up to 4 MB of the page blob. Writes to page blobs happen
in-place and are immediately committed to the blob. The maximum size
for a page blob is 8 TB.
Gets the maximum number of bytes that can be sent in a call
to the UploadPagesAsync operation.
Gets the number of bytes in a page (512).
protected PageBlobClient()
Initializes a new instance of the PageBlobClient
class for mocking.
Initializes a new instance of the PageBlobClient
class.
public PageBlobClient(string connectionString, string blobContainerName, string blobName, BlobClientOptions options)
Initializes a new instance of the PageBlobClient
class.
Initializes a new instance of the PageBlobClient
class.
public PageBlobClient(Uri blobUri, StorageSharedKeyCredential credential, BlobClientOptions options = null)
Initializes a new instance of the PageBlobClient
class.
Initializes a new instance of the PageBlobClient
class.
Initializes a new instance of the PageBlobClient
class.
public virtual Response<PageInfo> ClearPages(HttpRange range, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The ClearPages operation clears one or more
pages from the page blob, as specificed by the range.
For more information, see
Put Page.
public virtual Task<Response<PageInfo>> ClearPagesAsync(HttpRange range, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The ClearPagesAsync operation clears one or more
pages from the page blob, as specificed by the range.
For more information, see
Put Page.
public virtual Response<BlobContentInfo> Create(long size, PageBlobCreateOptions options, CancellationToken cancellationToken = default)
The Create
operation creates a new page blob of the specified size.
The content of any existing blob is overwritten with the newly initialized page blob
To add content to the page blob, call the
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Response<BlobContentInfo> Create(long size, long? sequenceNumber = default, BlobHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The Create
operation creates a new page blob of the specified size. The content of any
existing blob is overwritten with the newly initialized page blob
To add content to the page blob, call the
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Task<Response<BlobContentInfo>> CreateAsync(long size, PageBlobCreateOptions options, CancellationToken cancellationToken = default)
The CreateAsync
operation creates a new page blob of the specified size.
The content of any existing blob is overwritten with the newly initialized page blob
To add content to the page blob, call the
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Task<Response<BlobContentInfo>> CreateAsync(long size, long? sequenceNumber = default, BlobHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The CreateAsync
operation creates a new page blob of the specified size. The content of any
existing blob is overwritten with the newly initialized page blob
To add content to the page blob, call the
UploadPagesAsync operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Response<BlobContentInfo> CreateIfNotExists(long size, PageBlobCreateOptions options, CancellationToken cancellationToken = default)
The CreateIfNotExists
operation creates a new page blob of the specified size. If the blob already
exists, the content of the existing blob will remain unchanged. If the blob does not already exists,
a new page blob with the specified size will be created.
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Response<BlobContentInfo> CreateIfNotExists(long size, long? sequenceNumber = default, BlobHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, CancellationToken cancellationToken = default)
The CreateIfNotExists
operation creates a new page blob of the specified size. If the blob already
exists, the content of the existing blob will remain unchanged. If the blob does not already exists,
a new page blob with the specified size will be created.
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Task<Response<BlobContentInfo>> CreateIfNotExistsAsync(long size, PageBlobCreateOptions options, CancellationToken cancellationToken = default)
The CreateIfNotExistsAsync
operation creates a new page blob of the specified size. If the blob already
exists, the content of the existing blob will remain unchanged. If the blob does not already exists,
a new page blob with the specified size will be created.
UploadPages operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Task<Response<BlobContentInfo>> CreateIfNotExistsAsync(long size, long? sequenceNumber = default, BlobHttpHeaders httpHeaders = null, IDictionary<string, string> metadata = null, CancellationToken cancellationToken = default)
The CreateIfNotExistsAsync
operation creates a new page blob of the specified size. If the blob already exists,
the content of the existing blob will remain unchanged. If the blob does not already exists,
a new page blob with the specified size will be created.
UploadPagesAsync operation.
For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
public virtual Pageable<PageRangeItem> GetAllPageRanges(GetPageRangesOptions options = null, CancellationToken cancellationToken = default)
The GetAllPageRanges operation returns the list of
valid page ranges for a page blob or snapshot of a page blob.
For more information, see
Get Page Ranges.
public virtual AsyncPageable<PageRangeItem> GetAllPageRangesAsync(GetPageRangesOptions options = null, CancellationToken cancellationToken = default)
The GetAllPageRangesAsync operation returns the list of
valid page ranges for a page blob or snapshot of a page blob.
For more information, see
Get Page Ranges.
public virtual Pageable<PageRangeItem> GetAllPageRangesDiff(GetPageRangesDiffOptions options = null, CancellationToken cancellationToken = default)
The GetAllPageRangesDiff
operation returns the list of page ranges that differ between a
PreviousSnapshot and this page blob. Changed pages
include both updated and cleared pages.
For more information, see
Get Page Ranges.
public virtual AsyncPageable<PageRangeItem> GetAllPageRangesDiffAsync(GetPageRangesDiffOptions options = null, CancellationToken cancellationToken = default)
The GetAllPageRangesDiffAsync
operation returns the list of page ranges that differ between a
PreviousSnapshot and this page blob. Changed pages
include both updated and cleared pages.
For more information, see
Get Page Ranges.
public virtual Response<PageRangesInfo> GetManagedDiskPageRangesDiff(HttpRange? range = default, string snapshot = null, Uri previousSnapshotUri = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetManagedDiskPageRangesDiff
operation returns the list of page ranges that differ between a
previousSnapshotUri and this page blob. Changed pages
include both updated and cleared pages. This API only works with
managed disk storage accounts.
For more information, see
Get Page Ranges.
public virtual Task<Response<PageRangesInfo>> GetManagedDiskPageRangesDiffAsync(HttpRange? range = default, string snapshot = null, Uri previousSnapshotUri = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetManagedDiskPageRangesDiffAsync
operation returns the list of page ranges that differ between a
previousSnapshotUri and this page blob. Changed pages
include both updated and cleared pages. This API only works with
managed disk storage accounts.
For more information, see
Get Page Ranges.
public virtual Response<PageRangesInfo> GetPageRanges(HttpRange? range = default, string snapshot = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetPageRanges
operation returns the list of valid page ranges for a page blob or snapshot of a page blob.
For more information, see
Get Page Ranges.
public virtual Task<Response<PageRangesInfo>> GetPageRangesAsync(HttpRange? range = default, string snapshot = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetPageRangesAsync
operation returns the list of valid page ranges for a page blob or snapshot of a page blob.
For more information, see
Get Page Ranges.
public virtual Response<PageRangesInfo> GetPageRangesDiff(HttpRange? range = default, string snapshot = null, string previousSnapshot = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetPageRangesDiff
operation returns the list of page ranges that differ between a
previousSnapshot and this page blob. Changed pages
include both updated and cleared pages.
For more information, see
Get Page Ranges.
public virtual Task<Response<PageRangesInfo>> GetPageRangesDiffAsync(HttpRange? range = default, string snapshot = null, string previousSnapshot = null, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetPageRangesDiffAsync
operation returns the list of page ranges that differ between a
previousSnapshot and this page blob. Changed pages
include both updated and cleared pages.
For more information, see
Get Page Ranges.
public virtual Stream OpenWrite(bool overwrite, long position, PageBlobOpenWriteOptions options = null, CancellationToken cancellationToken = default)
Opens a stream for writing to the blob.
public virtual Task<Stream> OpenWriteAsync(bool overwrite, long position, PageBlobOpenWriteOptions options = null, CancellationToken cancellationToken = default)
Opens a stream for writing to the blob.
public virtual Response<PageBlobInfo> Resize(long size, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The Resize operation resizes the page blob to
the specified size (which must be a multiple of 512). If the
specified value is less than the current size of the blob, then
all pages above the specified value are cleared.
For more information, see
Set Blob Properties.
public virtual Task<Response<PageBlobInfo>> ResizeAsync(long size, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The ResizeAsync operation resizes the page blob to
the specified size (which must be a multiple of 512). If the
specified value is less than the current size of the blob, then
all pages above the specified value are cleared.
For more information, see
Set Blob Properties.
public virtual CopyFromUriOperation StartCopyIncremental(Uri sourceUri, string snapshot, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The StartCopyIncremental
operation starts copying a snapshot of the sourceUri page blob to
this page blob. The snapshot is copied such that only the
differential changes between the previously copied snapshot are
transferred to the destination. The copied snapshots are complete
copies of the original snapshot and can be read or copied from as
usual. You can check the CopyStatus
returned from the GetProperties to
determine if the copy has completed.
For more information, see
Incremental Copy Blob and
Back up Azure unmanaged VM disks with incremental snapshots.
public virtual Task<CopyFromUriOperation> StartCopyIncrementalAsync(Uri sourceUri, string snapshot, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The StartCopyIncrementalAsync
operation starts copying a snapshot of the sourceUri page blob to
this page blob. The snapshot is copied such that only the
differential changes between the previously copied snapshot are
transferred to the destination. The copied snapshots are complete
copies of the original snapshot and can be read or copied from as
usual. You can check the CopyStatus
returned from the GetPropertiesAsync
to determine if thecopy has completed.
For more information, see
Incremental Copy Blob and
Back up Azure unmanaged VM disks with incremental snapshots.
public virtual Response<PageBlobInfo> UpdateSequenceNumber(SequenceNumberAction action, long? sequenceNumber = default, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The UpdateSequenceNumber operation changes the
sequence number action and sequenceNumber
for this page blob.
For more information, see
Set Blob Properties.
public virtual Task<Response<PageBlobInfo>> UpdateSequenceNumberAsync(SequenceNumberAction action, long? sequenceNumber = default, PageBlobRequestConditions conditions = null, CancellationToken cancellationToken = default)
The UpdateSequenceNumberAsync operation changes the
sequence number action and sequenceNumber
for this page blob.
For more information, see
Set Blob Properties.
public virtual Response<PageInfo> UploadPages(Stream content, long offset, byte[] transactionalContentHash, PageBlobRequestConditions conditions, IProgress<long> progressHandler, CancellationToken cancellationToken)
The UploadPages operation writes
content to a range of pages in a page blob,
starting at offset.
For more information, see
Put Page.
public virtual Response<PageInfo> UploadPages(Stream content, long offset, PageBlobUploadPagesOptions options = null, CancellationToken cancellationToken = default)
The UploadPages operation writes
content to a range of pages in a page blob,
starting at offset.
For more information, see
Put Page.
public virtual Task<Response<PageInfo>> UploadPagesAsync(Stream content, long offset, byte[] transactionalContentHash, PageBlobRequestConditions conditions, IProgress<long> progressHandler, CancellationToken cancellationToken)
The UploadPagesAsync operation writes
content to a range of pages in a page blob,
starting at offset.
For more information, see
Put Page.
public virtual Task<Response<PageInfo>> UploadPagesAsync(Stream content, long offset, PageBlobUploadPagesOptions options = null, CancellationToken cancellationToken = default)
The UploadPagesAsync operation writes
content to a range of pages in a page blob,
starting at offset.
For more information, see
Put Page.
public virtual Response<PageInfo> UploadPagesFromUri(Uri sourceUri, HttpRange sourceRange, HttpRange range, PageBlobUploadPagesFromUriOptions options = null, CancellationToken cancellationToken = default)
The UploadPagesFromUri
operation writes a range of pages to a page blob where the contents are read from
sourceUri.
For more information, see
Put Page From URL.
public virtual Response<PageInfo> UploadPagesFromUri(Uri sourceUri, HttpRange sourceRange, HttpRange range, byte[] sourceContentHash, PageBlobRequestConditions conditions, PageBlobRequestConditions sourceConditions, CancellationToken cancellationToken)
The UploadPagesFromUri
operation writes a range of pages to a page blob where the contents are read from
sourceUri.
For more information, see
Put Page From URL.
public virtual Task<Response<PageInfo>> UploadPagesFromUriAsync(Uri sourceUri, HttpRange sourceRange, HttpRange range, PageBlobUploadPagesFromUriOptions options = null, CancellationToken cancellationToken = default)
The UploadPagesFromUriAsync
operation writes a range of pages to a page blob where the contents are read from
sourceUri.
For more information, see
Put Page From URL.
public virtual Task<Response<PageInfo>> UploadPagesFromUriAsync(Uri sourceUri, HttpRange sourceRange, HttpRange range, byte[] sourceContentHash, PageBlobRequestConditions conditions, PageBlobRequestConditions sourceConditions, CancellationToken cancellationToken)
The UploadPagesFromUriAsync
operation writes a range of pages to a page blob where the contents are read from
sourceUri.
For more information, see
Put Page From URL.
Initializes a new instance of the PageBlobClient
class with an identical Uri source but the specified
customerProvidedKey.
Initializes a new instance of the PageBlobClient
class with an identical Uri source but the specified
encryptionScope.
Initializes a new instance of the PageBlobClient
class with an identical Uri source but the specified
snapshot timestamp.
For more information, see
Create a snapshot of a blob.
Creates a new PageBlobClient object identical to the source but with the specified version ID.
Pass "" to remove the version ID returning a URL to the base blob.