public abstract class AbstractMigrator extends Object implements Migrator
Abstract migrator class containing methods and functionality needed by all extending migrator classes.
| Modifier and Type | Field and Description |
|---|---|
static int |
ACTIVE_TASKS |
static int |
BATCH_SIZE |
| Constructor and Description |
|---|
AbstractMigrator() |
| Modifier and Type | Method and Description |
|---|---|
void |
load(String uri,
String keyspace)
Migrate data constrained by this migrator using a loader configured
by the provided parameters.
|
void |
load(String uri,
String keyspace,
int batchSize,
int numberActiveTasks)
Migrate data constrained by this migrator using a loader configured
by the provided parameters.
|
AbstractMigrator |
registerMacro(Macro macro)
Register a macro to use in templating
|
protected <T> java.util.stream.Stream<T> |
stream(Iterator<T> iterator)
Partition a stream into a stream of collections, each with batchSize elements.
|
protected Optional<InsertQuery> |
template(String template,
Map<String,Object> data) |
protected boolean |
validValue(Object value)
Test if an object is a valid Grakn value
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final int BATCH_SIZE
public static final int ACTIVE_TASKS
public AbstractMigrator registerMacro(Macro macro)
public void load(String uri, String keyspace)
public void load(String uri, String keyspace, int batchSize, int numberActiveTasks)
load in interface Migratoruri - Uri where one instance of Grakn Engine is runningkeyspace - The name of the keyspace where the data should be persistedbatchSize - The number of queries to execute in one transaction. Default is 25.numberActiveTasks - Number of tasks running on the server at any one time. Consider this a safeguard
to bot the system load. Default is 25.protected Optional<InsertQuery> template(String template, Map<String,Object> data)
template - a string representing a templated graql querydata - data used in the templateprotected <T> java.util.stream.Stream<T> stream(Iterator<T> iterator)
T - Type of values of iteratoriterator - Iterator to partitionprotected boolean validValue(Object value)
value - object to checkCopyright © 2017 Grakn Labs Ltd. All rights reserved.