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

Added distributed lock API #159

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

zedgell
Copy link
Contributor

@zedgell zedgell commented Mar 27, 2024

Description

Added distributed lock API

Issue reference

This PR will close #86

Checklist

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

Signed-off-by: Zachary Edgell <[email protected]>
@zedgell zedgell requested review from a team as code owners March 27, 2024 06:02
zedgell added 3 commits March 27, 2024 02:21
Signed-off-by: Zachary Edgell <[email protected]>
Signed-off-by: Zachary Edgell <[email protected]>
Signed-off-by: Zachary Edgell <[email protected]>
Copy link
Member

@mikeee mikeee left a comment

Choose a reason for hiding this comment

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

Great stuff, some minor suggestions

src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
src/client.rs Outdated Show resolved Hide resolved
Comment on lines +459 to +475
/// Distributed lock request call
///
/// # Arguments
///
/// * `request` - Request to be made, TryLockRequest
pub async fn lock(&mut self, request: TryLockRequest) -> Result<TryLockResponse, Error> {
self.0.lock(request).await
}

/// Distributed lock request call
///
/// # Arguments
///
/// * `request` - Request to be made, TryLockRequest
pub async fn unlock(&mut self, request: UnlockRequest) -> Result<UnlockResponse, Error> {
self.0.unlock(request).await
}
Copy link
Member

@mikeee mikeee Mar 28, 2024

Choose a reason for hiding this comment

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

I think it would be beneficial to have examples here in the doc comments of building and using the api call e.g.

    /// # Example
    ///
    /// ```
    /// let result = client
    ///     .try_lock(dapr::client::TryLockRequest {
    ///         store_name: "lockstore".to_string(),
    ///         resource_id: "resource".to_string(),
    ///         lock_owner: "owner".to_string(),
    ///         expiry_in_seconds: 60,
    ///     })
    ///     .await
    ///     .unwrap();
    /// ```

examples/distributed-lock/main.rs Outdated Show resolved Hide resolved
examples/distributed-lock/main.rs Outdated Show resolved Hide resolved
examples/distributed-lock/main.rs Outdated Show resolved Hide resolved
examples/distributed-lock/main.rs Outdated Show resolved Hide resolved
examples/distributed-lock/main.rs Outdated Show resolved Hide resolved
examples/distributed-lock/README.md Outdated Show resolved Hide resolved
Copy link
Member

@mikeee mikeee left a comment

Choose a reason for hiding this comment

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

We can create another issue to track adding documentation but before a final review the APIs need to be defined in the interface -> https://github.com/dapr/rust-sdk/pull/159/files#diff-7f93c4e263c4e9ec748f804c7fd04a3b2fde86ffd741fb5516d67e1097bae4c1L545

Copy link

github-actions bot commented Jul 5, 2024

This pull request has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jul 5, 2024
@mikeee mikeee added P1 pinned dapr-bot exemption and removed stale labels Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 pinned dapr-bot exemption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add distributed lock API support
2 participants