org.nustaq.kontraktor.services.rlclient.DataClient Maven / Gradle / Ivy
package org.nustaq.kontraktor.services.rlclient;
import org.nustaq.kontraktor.*;
import org.nustaq.kontraktor.services.datacluster.DataCfg;
import org.nustaq.kontraktor.services.ServiceActor;
import org.nustaq.kontraktor.annotations.CallerSideMethod;
import org.nustaq.kontraktor.util.Log;
import org.nustaq.reallive.client.ShardedTable;
import org.nustaq.reallive.client.ClusteredTableSpaceClient;
import org.nustaq.reallive.server.actors.TableSpaceActor;
import org.nustaq.reallive.client.TableSpaceSharding;
import org.nustaq.reallive.api.RLPredicate;
import org.nustaq.reallive.api.RealLiveTable;
import org.nustaq.reallive.api.Record;
import org.nustaq.reallive.api.TableDescription;
import org.nustaq.serialization.FSTConfiguration;
import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* Created by ruedi on 15.08.2015.
*
* connector actor to rl data cluster
*
*/
public class DataClient extends ClusteredTableSpaceClient {
protected DataCfg config;
protected ServiceActor hostingService;
protected TableSpaceActor shards[];
protected HashMap syncTableAccess;
public IPromise connect( DataCfg config, TableSpaceActor shards[], ServiceActor hostingService ) {
this.config = config;
this.hostingService=hostingService;
this.shards = shards;
syncTableAccess = new HashMap();
tableSpaceSharding = createTableSpaceSharding(shards);
tableSpaceSharding.init().await();
TableDescription[] schema = config.getSchema();
return all( schema.length, i -> {
TableDescription desc = schema[i];
return initTable(desc);
});
}
protected TableSpaceSharding createTableSpaceSharding(TableSpaceActor[] shards) {
return new TableSpaceSharding(shards);
}
protected IPromise
© 2015 - 2025 Weber Informatics LLC | Privacy Policy