use of org.nustaq.kontraktor.services.ServiceActor in project kontraktor by RuedigerMoeller.
the class DataClient method connect.
public IPromise connect(DataCfg config, TableSpaceActor[] shards, ServiceActor hostingService) {
this.config = config;
this.hostingService = hostingService;
this.shards = shards;
syncTableAccess = new HashMap();
tableSharding = new TableSpaceSharding(shards, key -> Math.abs(key.hashCode()) % shards.length);
tableSharding.init().await();
TableDescription[] schema = config.getSchema();
return all(schema.length, i -> {
Promise p = new Promise();
tableSharding.createOrLoadTable(schema[i]).then((r, e) -> {
if (r != null) {
syncTableAccess.put(schema[i].getName(), r);
}
p.complete(r, e);
});
return p;
});
}
Aggregations