public class BatchMutatorClient extends Object
| Constructor and Description |
|---|
BatchMutatorClient(String keyspace,
String uri) |
BatchMutatorClient(String keyspace,
String uri,
java.util.function.Consumer<mjson.Json> onCompletionOfTask) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Query query)
Add an insert query to the queue.
|
void |
flush()
Load any remaining batches in the queue.
|
int |
getBatchSize()
Get the number of queries in each transaction
|
BatchMutatorClient |
setBatchSize(int size)
Set the size of the each transaction in terms of number of vars.
|
BatchMutatorClient |
setNumberActiveTasks(int size)
Number of active tasks running on the server at any one time.
|
BatchMutatorClient |
setRetryPolicy(boolean retry)
Tell the
BatchMutatorClient if it should retry sending tasks when the Engine
server is not available |
BatchMutatorClient |
setTaskCompletionConsumer(java.util.function.Consumer<mjson.Json> onCompletionOfTask)
Provide a consumer function to execute upon task completion
|
void |
waitToFinish()
Wait for all of the submitted tasks to have been completed
|
public BatchMutatorClient(String keyspace, String uri, java.util.function.Consumer<mjson.Json> onCompletionOfTask)
public BatchMutatorClient setRetryPolicy(boolean retry)
BatchMutatorClient if it should retry sending tasks when the Engine
server is not availableretry - boolean representing if engine should retrypublic BatchMutatorClient setTaskCompletionConsumer(java.util.function.Consumer<mjson.Json> onCompletionOfTask)
onCompletionOfTask - function applied to the last state of the taskpublic BatchMutatorClient setBatchSize(int size)
size - number of vars in each transactionpublic int getBatchSize()
public BatchMutatorClient setNumberActiveTasks(int size)
add(Query) method will block on the value of this field.size - number of tasks to allow to run at any given timepublic void add(Query query)
blockerSize which can be set with setNumberActiveTasks(int).
It will become unblocked as tasks are completed.query - insert query to be executedpublic void flush()
public void waitToFinish()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.