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

#906 -Added methods in status API supports for saving and reading binary data #1116

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

divzi-p
Copy link

@divzi-p divzi-p commented Jun 29, 2023

Description

#906 -Added methods in status API supports for saving and reading binary data.

Added methods to directly save and read Byte arrays.
New methods defined in DaprClient.cs
New methods implemented in DaprClientGrpc.cs
Unit tests written in StateApITest.cs

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[906]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

…f byte arrays dapr#906

Signed-off-by: Divya Perumal <divzi.perumal@gmail.com>
@divzi-p divzi-p requested review from a team as code owners June 29, 2023 06:28
Copy link
Contributor

@halspang halspang left a comment

Choose a reason for hiding this comment

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

Just a small change to ReadOnlyMemory<byte> from byte[].

src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
…y<byte>

Signed-off-by: Divya Perumal <divzi.perumal@gmail.com>
@divzi-p divzi-p requested a review from halspang August 28, 2023 05:43
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Attention: Patch coverage is 90.12346% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 66.78%. Comparing base (fd7168f) to head (4916d1a).
Report is 34 commits behind head on master.

❗ Current head 4916d1a differs from pull request most recent head ba6855c. Consider uploading reports for the commit ba6855c to get more accurate results

Files Patch % Lines
src/Dapr.Client/DaprClientGrpc.cs 90.12% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1116      +/-   ##
==========================================
+ Coverage   66.45%   66.78%   +0.32%     
==========================================
  Files         171      171              
  Lines        5750     5831      +81     
  Branches      624      635      +11     
==========================================
+ Hits         3821     3894      +73     
- Misses       1782     1788       +6     
- Partials      147      149       +2     
Flag Coverage Δ
net6 66.78% <90.12%> (+0.32%) ⬆️
net7 66.78% <90.12%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@halspang halspang left a comment

Choose a reason for hiding this comment

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

Unless you have strong thoughts/usability concerns, return type when fetching the binary data should match the input type when we save it.

src/Dapr.Client/DaprClient.cs Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
@divzi-p
Copy link
Author

divzi-p commented Jan 13, 2024

@halspang, @philliphoff - Thanks for your comments and sorry for the delay. Please review.

Copy link

@alanta alanta left a comment

Choose a reason for hiding this comment

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

Looks ok, except for the incomplete comments. I made some suggestions and I think you can copy a lot of the parameter comments from other methods.

src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
ArgumentVerifier.ThrowIfNullOrEmpty(storeName, nameof(storeName));
ArgumentVerifier.ThrowIfNullOrEmpty(key, nameof(key));
ArgumentVerifier.ThrowIfNull(etag, nameof(etag));
return await this.MakeSaveByteStateCallAsync(storeName, key, ByteString.CopyFrom(value.Span), etag, stateOptions, metadata, cancellationToken);
Copy link

Choose a reason for hiding this comment

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

Since you're not doing anything with the result of the awaited task you can optimize the code a bit by dropping the await here and remove async from the method signature

Copy link
Author

Choose a reason for hiding this comment

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

I think this 'await' is needed as MakeSaveByteStateCallAsync is an asyc task. Similar to method-TrySaveStateAsync. Thanks.

src/Dapr.Client/DaprClientGrpc.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
src/Dapr.Client/DaprClient.cs Outdated Show resolved Hide resolved
@divzi-p divzi-p requested a review from alanta April 30, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants