public interface CoordinationSession extends AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static class |
CoordinationSession.State |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> |
acquireEphemeralSemaphore(String name,
boolean exclusive,
byte[] data,
Duration timeout)
Acquire an ephemeral semaphore.
|
default CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> |
acquireEphemeralSemaphore(String name,
boolean exclusive,
Duration timeout)
Acquire an ephemeral semaphore.
|
CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> |
acquireSemaphore(String name,
long count,
byte[] data,
Duration timeout)
Acquire an semaphore.
|
default CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> |
acquireSemaphore(String name,
long count,
Duration timeout)
Acquire a semaphore.
|
void |
addStateListener(Consumer<CoordinationSession.State> listener) |
default void |
close() |
CompletableFuture<tech.ydb.core.Status> |
connect()
Establish new bidirectional grpc stream
|
default CompletableFuture<tech.ydb.core.Status> |
createSemaphore(String name,
long limit)
Create a new semaphore.
|
CompletableFuture<tech.ydb.core.Status> |
createSemaphore(String name,
long limit,
byte[] data)
Create a new semaphore.
|
default CompletableFuture<tech.ydb.core.Status> |
deleteSemaphore(String name)
Remove a semaphore.
|
CompletableFuture<tech.ydb.core.Status> |
deleteSemaphore(String name,
boolean force)
Remove a semaphore.
|
CompletableFuture<tech.ydb.core.Result<SemaphoreDescription>> |
describeSemaphore(String name,
DescribeSemaphoreMode mode) |
long |
getId()
Current session identifier.
|
CoordinationSession.State |
getState() |
void |
removeStateListener(Consumer<CoordinationSession.State> listener) |
CompletableFuture<tech.ydb.core.Status> |
stop()
Send message to grpc server to stop stream.
|
CompletableFuture<tech.ydb.core.Status> |
updateSemaphore(String name,
byte[] data)
Update data attached to the semaphore.
|
CompletableFuture<tech.ydb.core.Result<SemaphoreWatcher>> |
watchSemaphore(String name,
DescribeSemaphoreMode describeMode,
WatchSemaphoreMode watchMode) |
CompletableFuture<tech.ydb.core.Status> connect()
CompletableFuture<tech.ydb.core.Status> stop()
long getId()
CoordinationSession.State getState()
void addStateListener(Consumer<CoordinationSession.State> listener)
void removeStateListener(Consumer<CoordinationSession.State> listener)
default void close()
close in interface AutoCloseableCompletableFuture<tech.ydb.core.Status> createSemaphore(String name, long limit, byte[] data)
name - Name of the semaphore to createlimit - Number of tokens that may be acquired by sessionsdata - User-defined data that will be attached to the semaphoreALREADY_EXISTS status.CompletableFuture<tech.ydb.core.Status> updateSemaphore(String name, byte[] data)
name - Name of the semaphore to updatedata - User-defined data that will be attached to the semaphoreCompletableFuture<tech.ydb.core.Status> deleteSemaphore(String name, boolean force)
name - Name of the semaphore to removeforce - Will delete semaphore even if it's currently acquired by sessionsCompletableFuture<tech.ydb.core.Result<SemaphoreLease>> acquireSemaphore(String name, long count, byte[] data, Duration timeout)
WARNING: a single session can acquire only one semaphore in one moment
Later requests override previous operations with the same semaphore, e.g. to reduce acquired count, change timeout or attached data
name - Name of the semaphore to acquirecount - Number of tokens to acquire on the semaphoretimeout - Duration after which operation will fail if it's still waiting in the waiters queuedata - User-defined binary data that may be attached to the operationname, future will return a semaphore lease object.
If there is no such a semaphore, future will complete exceptionally
with UnexpectedResultException.CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> acquireEphemeralSemaphore(String name, boolean exclusive, byte[] data, Duration timeout)
WARNING: a single session can acquire only one semaphore in one moment
Later requests override previous operations with the same semaphore, e.g. to reduce acquired count, change timeout or attached data
name - Name of the semaphore to acquireexclusive - Flag of exclusive acquiringtimeout - Duration after which operation will fail if it's still waiting in the waiters queuedata - User-defined binary data that may be attached to the operationCompletableFuture<tech.ydb.core.Result<SemaphoreDescription>> describeSemaphore(String name, DescribeSemaphoreMode mode)
CompletableFuture<tech.ydb.core.Result<SemaphoreWatcher>> watchSemaphore(String name, DescribeSemaphoreMode describeMode, WatchSemaphoreMode watchMode)
default CompletableFuture<tech.ydb.core.Status> createSemaphore(String name, long limit)
name - Name of the semaphore to createlimit - Number of tokens that may be acquired by sessionsdefault CompletableFuture<tech.ydb.core.Status> deleteSemaphore(String name)
name - Name of the semaphore to removedefault CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> acquireSemaphore(String name, long count, Duration timeout)
WARNING: a single session can acquire only one semaphore in one moment
Later requests override previous operations with the same semaphore, e.g. to reduce acquired count, change timeout or attached data
name - Name of the semaphore to acquirecount - Number of tokens to acquire on the semaphoretimeout - Duration after which operation will fail if it's still waiting in the waiters queuedefault CompletableFuture<tech.ydb.core.Result<SemaphoreLease>> acquireEphemeralSemaphore(String name, boolean exclusive, Duration timeout)
WARNING: a single session can acquire only one semaphore in one moment
Later requests override previous operations with the same semaphore, e.g. to reduce acquired count, change timeout or attached data
name - Name of the semaphore to acquireexclusive - Flag of exclusive acquiringtimeout - Duration after which operation will fail if it's still waiting in the waiters queueCopyright © 2025. All rights reserved.