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

Support distributed lock API #764

Merged
merged 18 commits into from
Sep 22, 2023
Merged

Conversation

CrazyHZM
Copy link
Member

Description

Please explain the changes you've made

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: #747

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

Signed-off-by: crazyhzm <crazyhzm@gmail.com>
@CrazyHZM CrazyHZM requested review from a team as code owners July 25, 2022 07:31
Copy link
Contributor

@mukundansundar mukundansundar left a comment

Choose a reason for hiding this comment

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

@CrazyHZM
Thanks for this PR!! Added some comments. Please add E2E, example and it's validation for this api with both http and grpc. See the configuration api implementation for the Preview Client change if needed.

sdk/src/main/java/io/dapr/client/domain/UnLockRequest.java Outdated Show resolved Hide resolved
sdk/src/main/java/io/dapr/client/domain/LockRequest.java Outdated Show resolved Hide resolved
sdk/src/main/java/io/dapr/client/DaprClientHttp.java Outdated Show resolved Hide resolved
sdk/src/main/java/io/dapr/client/DaprClient.java Outdated Show resolved Hide resolved
CrazyHZM added 3 commits July 26, 2022 17:20
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
@mukundansundar
Copy link
Contributor

@CrazyHZM Please fix conflicts in the PR ...

CrazyHZM and others added 4 commits September 8, 2022 13:57
Signed-off-by: crazyhzm <crazyhzm@gmail.com>

# Conflicts:
#	pom.xml
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
@artursouza artursouza self-assigned this Sep 9, 2022
Copy link
Member

@artursouza artursouza left a comment

Choose a reason for hiding this comment

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

Pretty close to be merged. Thanks.

/**
* DistributedLockGrpcClient.
*/
public class DistributedLockGrpcClient {
Copy link
Member

Choose a reason for hiding this comment

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

We don't need an example for both HTTP and gRPC since the SDK abstract that.
It would be great if the example was using the APIs to make something more useful, like leader election, for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

It has not been deleted for the time being, and new examples can be added in the future.

sdk/src/main/java/io/dapr/client/domain/LockRequest.java Outdated Show resolved Hide resolved
Copy link
Contributor

@johnewart johnewart left a comment

Choose a reason for hiding this comment

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

Just small requests re: magic strings but not a blocker.

sdk/src/main/java/io/dapr/client/DaprClientHttp.java Outdated Show resolved Hide resolved
sdk/src/main/java/io/dapr/client/DaprClientHttp.java Outdated Show resolved Hide resolved
return Mono.just(UnlockResponseStatus.INTERNAL_ERROR);
}

Integer statusCode = (Integer) m.get("status");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - can we make "status" a constant so it's guaranteed to be consistent anywhere it gets used?

Copy link
Member Author

Choose a reason for hiding this comment

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

For the time being, only the lock api is in use, and if there is a scene in the future, it will be extracted

Signed-off-by: crazyhzm <crazyhzm@gmail.com>
Signed-off-by: crazyhzm <crazyhzm@gmail.com>

# Conflicts:
#	sdk/src/main/java/io/dapr/client/AbstractDaprClient.java
#	sdk/src/main/java/io/dapr/client/DaprClientGrpc.java
#	sdk/src/main/java/io/dapr/client/DaprClientHttp.java
#	sdk/src/main/java/io/dapr/client/DaprPreviewClient.java
#	sdk/src/test/java/io/dapr/client/DaprPreviewClientGrpcTest.java
#	sdk/src/test/java/io/dapr/client/DaprPreviewClientHttpTest.java
Signed-off-by: crazyhzm <crazyhzm@gmail.com>
@CrazyHZM CrazyHZM requested review from mukundansundar and artursouza and removed request for mukundansundar December 10, 2022 15:28
@hhunter-ms hhunter-ms mentioned this pull request Mar 16, 2023
11 tasks
@msfussell
Copy link
Member

@mukundansundar @artursouza - Is this ready for review?

Signed-off-by: Artur Souza <asouza.pro@gmail.com>
@artursouza artursouza force-pushed the feat/support_lock_api branch from 91472c9 to a32bc85 Compare September 20, 2023 23:46
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 62.22% and project coverage change: -0.44% ⚠️

Comparison is base (b442ba4) 76.47% compared to head (a32bc85) 76.04%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #764      +/-   ##
============================================
- Coverage     76.47%   76.04%   -0.44%     
- Complexity     1398     1427      +29     
============================================
  Files           132      135       +3     
  Lines          4264     4399     +135     
  Branches        497      514      +17     
============================================
+ Hits           3261     3345      +84     
- Misses          743      776      +33     
- Partials        260      278      +18     
Files Changed Coverage Δ
...k/src/main/java/io/dapr/client/DaprClientHttp.java 82.88% <48.00%> (-4.01%) ⬇️
...k/src/main/java/io/dapr/client/DaprClientGrpc.java 86.10% <56.00%> (-3.03%) ⬇️
...va/io/dapr/client/domain/UnlockResponseStatus.java 76.92% <76.92%> (ø)
...c/main/java/io/dapr/client/AbstractDaprClient.java 85.32% <100.00%> (+0.55%) ⬆️
...c/main/java/io/dapr/client/domain/LockRequest.java 100.00% <100.00%> (ø)
...main/java/io/dapr/client/domain/UnlockRequest.java 100.00% <100.00%> (ø)

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

@artursouza artursouza merged commit 86893a0 into dapr:master Sep 22, 2023
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.

Add distributed lock API support
5 participants