userver: ydb::CoordinationSession Class Reference
Loading...
Searching...
No Matches
ydb::CoordinationSession Class Referencefinal

#include <userver/ydb/coordination.hpp>

Detailed Description

Coordination Session.

See also
https://ydb.tech/docs/ru/reference/ydb-sdk/coordination#session

Definition at line 22 of file coordination.hpp.

Public Types

enum class  Mode {
  kNormal ,
  kForce
}
 Semaphore deletion mode. More...

Public Member Functions

std::uint64_t GetSessionId ()
 Get session id.
NYdb::NCoordination::ESessionState GetSessionState ()
 Get session state.
NYdb::NCoordination::EConnectionState GetConnectionState ()
 Get connection state.
void Close ()
 Close session.
void Ping ()
 Ping.
void Reconnect ()
 Reconnect session.
bool AcquireSemaphore (std::string_view name, const NYdb::NCoordination::TAcquireSemaphoreSettings &settings)
bool ReleaseSemaphore (std::string_view name)
 Release semaphore.
NYdb::NCoordination::TSemaphoreDescription DescribeSemaphore (std::string_view name, const NYdb::NCoordination::TDescribeSemaphoreSettings &settings)
void CreateSemaphore (std::string_view name, std::uint64_t limit, std::string_view data={})
void UpdateSemaphore (std::string_view name, std::string_view data)
 Update semaphore.
void DeleteSemaphore (std::string_view name, Mode mode=Mode::kNormal)

Member Enumeration Documentation

◆ Mode

enum class ydb::CoordinationSession::Mode
strong

Semaphore deletion mode.

Enumerator
kNormal 

Fail if the semaphore is currently acquired.

kForce 

Delete even if currently acquired by sessions.

Definition at line 71 of file coordination.hpp.

Member Function Documentation

◆ AcquireSemaphore()

bool ydb::CoordinationSession::AcquireSemaphore ( std::string_view name,
const NYdb::NCoordination::TAcquireSemaphoreSettings & settings )

Acquire semaphore

Warning
Use TAcquireSemaphoreSettings::OnAccepted callback with care, it will be executed on a non-coroutine thread

◆ CreateSemaphore()

void ydb::CoordinationSession::CreateSemaphore ( std::string_view name,
std::uint64_t limit,
std::string_view data = {} )

Create semaphore

Parameters
datauser-defined data attached to the semaphore

◆ DeleteSemaphore()

void ydb::CoordinationSession::DeleteSemaphore ( std::string_view name,
Mode mode = Mode::kNormal )

Delete semaphore

Parameters
modedeletion mode; use Mode::kForce to delete even if currently acquired

◆ DescribeSemaphore()

NYdb::NCoordination::TSemaphoreDescription ydb::CoordinationSession::DescribeSemaphore ( std::string_view name,
const NYdb::NCoordination::TDescribeSemaphoreSettings & settings )

Describe semaphore

Warning
Use TDescribeSemaphoreSettings::OnChanged callback with care, it will be executed on a non-coroutine thread

The documentation for this class was generated from the following file: