Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage][blob] Create BlobBatchClient based on API review feedback #5634

Merged
merged 15 commits into from Oct 21, 2019

Conversation

xirzec
Copy link
Member

@xirzec xirzec commented Oct 17, 2019

This change:

  • Renames BatchRequest to BatchBlob
  • Flattens BatchDeleteRequest and BatchSetTierRequest into BatchBlob
  • Moves submitBatch code from BlobServiceClient into new BlobBatchClient
  • Created new deleteBlobs and setBlobsAccessTier helpers on BlobBatchClient
  • Adjusted existing tests
  • Added new tests for deleteBlobs and setBlobsAccessTier

Fixes #5527

@xirzec xirzec added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Oct 17, 2019
@xirzec xirzec self-assigned this Oct 17, 2019
@jeremymeng
Copy link
Contributor

jeremymeng commented Oct 17, 2019

  .byPage({ maxPageSize: 1 })

Not sure why the old code retrieve a page with one item, we should remove the option. #Resolved


Refers to: sdk/storage/storage-blob/test/blobbatch.spec.ts:113 in cf04032. [](commit_id = cf04032, deletion_comment = False)

@jeremymeng
Copy link
Contributor

  .byPage({ maxPageSize: 1 })

oh, possibly just like .Any()


In reply to: 543386750 [](ancestors = 543386750)


Refers to: sdk/storage/storage-blob/test/blobbatch.spec.ts:113 in cf04032. [](commit_id = cf04032, deletion_comment = False)

Copy link
Contributor

@jeremymeng jeremymeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jiacfan
Copy link
Member

jiacfan commented Oct 18, 2019

  • Add a delete operation(subrequest) to mark the specified blob or snapshot for deletion.

Same comments for deleteBlob and setBlobTierAccess APIs, please ensure the comments across languages, I think that would be important as well, as the document is exposed to users and it's their first guide.


Refers to: sdk/storage/storage-blob/src/BlobBatch.ts:123 in 42fee72. [](commit_id = 42fee72, deletion_comment = False)

* ```
*
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch
* Creates a BlobBatchClient object
Copy link
Member

@jiacfan jiacfan Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: missed . at end, and please ensure the comment alignment with other languages, e.g.: should here be link of introduction to BlobBatchClient object?

@@ -12,7 +12,7 @@ export * from "./BlobClient";
export * from "./AppendBlobClient";
export * from "./BlockBlobClient";
export * from "./PageBlobClient";
export * from "./BatchRequest";
export * from "./BlobBatch";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlobBatchClient.ts is missed here?

@@ -16,7 +16,7 @@ export * from "./AccountSASPermissions";
export * from "./AccountSASResourceTypes";
export * from "./AccountSASServices";
export * from "./AccountSASSignatureValues";
export * from "./BatchRequest";
export * from "./BlobBatch";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlobBatchClient.ts is missed here?

Copy link
Member

@jiacfan jiacfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@XiaoningLiu
Copy link
Member

  • A BatchRequest represents a based class for BatchDeleteRequest and BatchSetTierRequest.

typo


Refers to: sdk/storage/storage-blob/src/BlobBatch.ts:52 in 42fee72. [](commit_id = 42fee72, deletion_comment = False)

@@ -126,7 +113,7 @@ export class BatchDeleteRequest extends BatchRequest {
* @returns {Promise<void>}
* @memberof BatchDeleteRequest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BatchDeleteRequest [](start = 15, length = 18)

needs to update

* @param {BlobBatch} batchRequest A set of Delete or SetTier operations.
* @param {BlobBatchSubmitBatchOptionalParams} [options]
* @returns {Promise<BlobBatchSubmitBatchResponse>}
* @memberof BlobServiceClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlobServiceClient [](start = 15, length = 17)

typo, please check all inline Jsdoc comments align with new added classes

* Fix a number of comment issues
* Prevent consumer from mixing operation types inside a single batch
* Actually export the new types
@xirzec
Copy link
Member Author

xirzec commented Oct 18, 2019

Same comments for deleteBlob and setBlobTierAccess APIs, please ensure the comments across languages, I think that would be important as well, as the document is exposed to users and it's their first guide.

I aligned the comments with .NET, which seems to have copied them verbatim from the REST documentation. Let me know if this is what you expected.

@xirzec xirzec requested a review from jiacfan October 18, 2019 19:14
Copy link
Member

@jiacfan jiacfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -49,14 +49,16 @@ export interface BatchSubRequest {
}

/**
* A BatchRequest represents a based class for BatchDeleteRequest and BatchSetTierRequest.
* A BlobBatch represents an aggregated set of operations on blobs.
* Currently, only delete and setAccessTier are supported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would better add comments like: only one kind of operation is supported per batch. This might be applicable to other langs.

@jiacfan
Copy link
Member

jiacfan commented Oct 21, 2019

Please remember to test it with CI and live account testing, and test samples with import the package to ensure everything works.

* This operation does not update the blob's ETag.
* For detailed information about block blob level tiering
* see [hot, cool, and archive access tiers](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers).
* The operation will be authenticated and authorized
* with specified credential.See [blob batch authorization details](https://docs.microsoft.com/en-us/rest/api/storageservices/blob-batch#authorization).
*
* @param {string} url The url of the blob resource to delete.
* @param {Credential} credential The credential to be used for authentication and authorization.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SharedKeyCredential | AnonymousCredential | TokenCredential

Please go through types for JSDoc parameters

@HarshaNalluru
Copy link
Member

/azp run js - storage-blob - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Storage][Blob] Adjust BatchClient based on the api review feedback for other languages
6 participants