Skip to content

Extend ydb::CoordinationSession semaphore methods#1114

Open
Ilya-Repin wants to merge 1 commit intouserver-framework:developfrom
Ilya-Repin:add-semaphore-method-args
Open

Extend ydb::CoordinationSession semaphore methods#1114
Ilya-Repin wants to merge 1 commit intouserver-framework:developfrom
Ilya-Repin:add-semaphore-method-args

Conversation

@Ilya-Repin
Copy link

Updated ydb::CoordinationSession semaphore methods (CreateSemaphore, DeleteSemaphore)

  1. CreateSemaphore: Added std::string_view data argument (default is empty). Allows attaching user-defined metadata to the semaphore upon creation. SDK method
  2. DeleteSemaphore: Added bool force argument (default is false). Enables force deletion of the semaphore. SDK method

Copy link
Member

@apolukhin apolukhin left a comment

Choose a reason for hiding this comment

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

Looks good, please apply a few tweaks:

@@ -61,13 +61,13 @@ class CoordinationSession final {
);

/// Create semaphore
Copy link
Member

Choose a reason for hiding this comment

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

Please, add a description for data parameter


/// Delete semaphore
void DeleteSemaphore(std::string_view name);
void DeleteSemaphore(std::string_view name, bool force = false);
Copy link
Member

Choose a reason for hiding this comment

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

Use enum instead of bool. With enums the code becomes more readable:

x.DeleteSemaphore("foo", true);

vs

x.DeleteSemaphore("foo", Mode::kForce);

void CoordinationSession::DeleteSemaphore(std::string_view name) {
ExtractResult(session_.DeleteSemaphore(impl::ToString(name)), "DeleteSemaphore");
void CoordinationSession::DeleteSemaphore(std::string_view name, bool force) {
ExtractResult(session_.DeleteSemaphore(impl::ToString(name), force), "DeleteSemaphore");
Copy link
Member

Choose a reason for hiding this comment

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

Please add tests for the both additions

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.

2 participants