-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #462
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/io/tarantool/driver/api/space/options/crud/OperationWithBalanceOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.tarantool.driver.api.space.options.crud; | ||
|
||
import java.util.Optional; | ||
|
||
import io.tarantool.driver.api.space.options.Options; | ||
import io.tarantool.driver.api.space.options.Self; | ||
import io.tarantool.driver.api.space.options.crud.enums.ProxyOption; | ||
|
||
/** | ||
* Base interface for all operation options that may have a configurable "balance" option. | ||
* | ||
* @author Belonogov Nikolay | ||
*/ | ||
public interface OperationWithBalanceOptions<T extends OperationWithBalanceOptions<T>> extends Options, Self<T> { | ||
|
||
/** | ||
* Sets "balance" option value to true. If true then use replica according to vshard load balancing policy. Default | ||
* value is false. | ||
* | ||
* @return this options instance. | ||
*/ | ||
default T balance() { | ||
addOption(ProxyOption.BALANCE, true); | ||
return self(); | ||
} | ||
|
||
/** | ||
* @return "balance" option value. | ||
*/ | ||
default Optional<Boolean> getBalance() { | ||
return getOption(ProxyOption.BALANCE, Boolean.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters