-
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.
Add support for "yield_every" option
Closes #458
- Loading branch information
Showing
4 changed files
with
54 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
32 changes: 32 additions & 0 deletions
32
src/main/java/io/tarantool/driver/api/space/options/crud/OperationWithYieldEveryOptions.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,32 @@ | ||
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; | ||
|
||
public interface OperationWithYieldEveryOptions<T extends OperationWithYieldEveryOptions<T>> | ||
extends Options, Self<T> { | ||
|
||
/** | ||
* Sets number of tuples processed on storage to yield after, "yield_every" should be > 0. | ||
* @param yieldEvery number of tuples processed on storage to yield after, "yield_every" should be > 0. | ||
* @return this option instance. | ||
* @throws IllegalArgumentException if yieldEvery < 0. | ||
*/ | ||
default T withYieldEvery(int yieldEvery) throws IllegalArgumentException { | ||
if (yieldEvery <= 0) { | ||
throw new IllegalArgumentException("Parameter \"yield_every\" must be greater than 0"); | ||
} | ||
addOption(ProxyOption.YIELD_EVERY, yieldEvery); | ||
return self(); | ||
} | ||
|
||
/** | ||
* @return "yield_every" parameter value. | ||
*/ | ||
default Optional<Integer> getYieldEvery() { | ||
return getOption(ProxyOption.BUCKET_ID, Integer.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