Java Code Examples for io.atomix.primitive.operation.OperationType#COMMAND
The following examples show how to use
io.atomix.primitive.operation.OperationType#COMMAND .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrimaryBackupServiceContext.java From atomix with Apache License 2.0 | 5 votes |
/** * Increments the current index and returns true if the given index is the next index. * * @param index the index to which to increment the current index * @return indicates whether the current index was successfully incremented */ public boolean nextIndex(long index) { if (operationIndex + 1 == index) { currentOperation = OperationType.COMMAND; operationIndex++; return true; } return false; }
Example 2
Source File: PrimaryBackupServiceContext.java From atomix with Apache License 2.0 | 5 votes |
/** * Resets the current index to the given index and timestamp. * * @param index the index to which to reset the current index * @param timestamp the timestamp to which to reset the current timestamp */ public void resetIndex(long index, long timestamp) { currentOperation = OperationType.COMMAND; operationIndex = index; currentIndex = index; currentTimestamp = timestamp; setCommitIndex(index); service.tick(new WallClockTimestamp(currentTimestamp)); }
Example 3
Source File: PrimaryRole.java From atomix with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<ExecuteResponse> execute(ExecuteRequest request) { logRequest(request); if (request.operation().id().type() == OperationType.COMMAND) { return executeCommand(request).thenApply(this::logResponse); } else if (request.operation().id().type() == OperationType.QUERY) { return executeQuery(request).thenApply(this::logResponse); } return Futures.exceptionalFuture(new IllegalArgumentException("Unknown operation type")); }
Example 4
Source File: AtomicSemaphoreService.java From atomix with Apache License 2.0 | 4 votes |
@Operation(value = "acquire", type = OperationType.COMMAND) void acquire(long id, int permits, long timeout);
Example 5
Source File: AtomicSemaphoreService.java From atomix with Apache License 2.0 | 4 votes |
@Operation(value = "release", type = OperationType.COMMAND) void release(int permits);
Example 6
Source File: AtomicSemaphoreService.java From atomix with Apache License 2.0 | 4 votes |
@Operation(value = "drain", type = OperationType.COMMAND) int drain();
Example 7
Source File: AtomicSemaphoreService.java From atomix with Apache License 2.0 | 4 votes |
@Operation(value = "increase", type = OperationType.COMMAND) int increase(int permits);
Example 8
Source File: AtomicSemaphoreService.java From atomix with Apache License 2.0 | 4 votes |
@Operation(value = "reduce", type = OperationType.COMMAND) int reduce(int permits);
Example 9
Source File: PrimaryBackupServiceContext.java From atomix with Apache License 2.0 | 2 votes |
/** * Increments and returns the next service index. * * @return the next index */ public long nextIndex() { currentOperation = OperationType.COMMAND; return ++operationIndex; }
Example 10
Source File: PrimaryBackupServiceContext.java From atomix with Apache License 2.0 | 2 votes |
/** * Sets the current index. * * @param index the current index. * @return the current index */ public long setIndex(long index) { currentOperation = OperationType.COMMAND; currentIndex = index; return currentIndex; }