org.nustaq.kontraktor.services.rlclient.DataClient Maven / Gradle / Ivy
package org.nustaq.kontraktor.services.rlclient;
import org.nustaq.kontraktor.*;
import org.nustaq.kontraktor.services.ServiceActor;
import org.nustaq.kontraktor.annotations.CallerSideMethod;
import org.nustaq.kontraktor.util.Log;
import org.nustaq.reallive.impl.actors.ShardedTable;
import org.nustaq.reallive.impl.tablespace.ClusteredTableSpaceClient;
import org.nustaq.reallive.impl.tablespace.TableSpaceActor;
import org.nustaq.reallive.impl.tablespace.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 {
DataCfg config;
ServiceActor hostingService;
TableSpaceActor shards[];
HashMap syncTableAccess;
public IPromise connect( DataCfg config, TableSpaceActor shards[], ServiceActor hostingService ) {
this.config = config;
this.hostingService=hostingService;
this.shards = shards;
syncTableAccess = new HashMap();
tableSpaceSharding = new TableSpaceSharding(shards);
tableSpaceSharding.init().await();
TableDescription[] schema = config.getSchema();
return all( schema.length, i -> {
TableDescription desc = schema[i];
return initTable(desc);
});
}
private IPromise
© 2015 - 2025 Weber Informatics LLC | Privacy Policy