Search in sources :

Example 1 with KeyValueTableFactoryImpl

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);
}
Also used : ConnectionPool(io.pravega.client.connection.impl.ConnectionPool) ConnectionFactory(io.pravega.client.connection.impl.ConnectionFactory) KeyValueTableFactoryImpl(io.pravega.client.tables.impl.KeyValueTableFactoryImpl) ConnectionPoolImpl(io.pravega.client.connection.impl.ConnectionPoolImpl) ControllerImpl(io.pravega.client.control.impl.ControllerImpl) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) Controller(io.pravega.client.control.impl.Controller)

Example 2 with KeyValueTableFactoryImpl

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);
}
Also used : TestingServerStarter(io.pravega.test.common.TestingServerStarter) KeyValueTableFactoryImpl(io.pravega.client.tables.impl.KeyValueTableFactoryImpl) ConnectionPoolImpl(io.pravega.client.connection.impl.ConnectionPoolImpl) ClientConfig(io.pravega.client.ClientConfig) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) Before(org.junit.Before)

Aggregations

ConnectionPoolImpl (io.pravega.client.connection.impl.ConnectionPoolImpl)2 SocketConnectionFactoryImpl (io.pravega.client.connection.impl.SocketConnectionFactoryImpl)2 KeyValueTableFactoryImpl (io.pravega.client.tables.impl.KeyValueTableFactoryImpl)2 ClientConfig (io.pravega.client.ClientConfig)1 ConnectionFactory (io.pravega.client.connection.impl.ConnectionFactory)1 ConnectionPool (io.pravega.client.connection.impl.ConnectionPool)1 Controller (io.pravega.client.control.impl.Controller)1 ControllerImpl (io.pravega.client.control.impl.ControllerImpl)1 PravegaConnectionListener (io.pravega.segmentstore.server.host.handler.PravegaConnectionListener)1 TestingServerStarter (io.pravega.test.common.TestingServerStarter)1 ControllerWrapper (io.pravega.test.integration.demo.ControllerWrapper)1 Before (org.junit.Before)1