use of io.pravega.client.tables.impl.KeyValueTableFactoryImpl in project pravega by pravega.
the class KeyValueTableFactory method withScope.
/**
* Creates a new instance of {@link KeyValueTableFactory}.
*
* @param scope The Key-Value Table scope.
* @param config Configuration for the client.
* @return Instance of {@link KeyValueTableFactory} implementation.
*/
static KeyValueTableFactory withScope(String scope, ClientConfig config) {
ConnectionFactory connectionFactory = new SocketConnectionFactoryImpl(config);
ConnectionPool connectionPool = new ConnectionPoolImpl(config, connectionFactory);
Controller controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(config).build(), connectionFactory.getInternalExecutor());
return new KeyValueTableFactoryImpl(scope, controller, connectionPool);
}
use of io.pravega.client.tables.impl.KeyValueTableFactoryImpl in project pravega by pravega.
the class KeyValueTableTest method setup.
@Override
@Before
public void setup() throws Exception {
super.setup();
// 1. Start ZK
this.zkTestServer = new TestingServerStarter().start();
// 2. Start Pravega SegmentStore service.
this.serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
this.tableStore = serviceBuilder.createTableStoreService();
this.serverListener = new PravegaConnectionListener(false, servicePort, serviceBuilder.createStreamSegmentService(), this.tableStore, executorService());
this.serverListener.startListening();
// 3. Start Pravega Controller service
this.controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
this.controllerWrapper.awaitRunning();
this.controller = controllerWrapper.getController();
// 4. Create Scope
this.controller.createScope(SCOPE).get();
ClientConfig clientConfig = ClientConfig.builder().build();
SocketConnectionFactoryImpl connectionFactory = new SocketConnectionFactoryImpl(clientConfig);
this.connectionPool = new ConnectionPoolImpl(clientConfig, connectionFactory);
this.keyValueTableFactory = new KeyValueTableFactoryImpl(SCOPE, this.controller, this.connectionPool);
}
Aggregations