Search in sources :

Example 1 with CoordinatorContext

use of io.dingodb.server.coordinator.context.CoordinatorContext in project dingo by dingodb.

the class CoordinatorServer method start.

public void start(final CoordinatorOptions opts) throws Exception {
    this.svrOpts = opts;
    log.info("Coordinator all configuration: {}.", this.svrOpts);
    log.info("instance configuration: {}.", DingoOptions.instance());
    this.context = new CoordinatorContext();
    final String raftId = svrOpts.getRaft().getGroup();
    final Endpoint endpoint = new Endpoint(svrOpts.getIp(), svrOpts.getRaft().getPort());
    final RocksRawKVStore rawKVStore = createRocksDB();
    final CoordinatorStateMachine stateMachine = createStateMachine(raftId, rawKVStore, context);
    final Node node = RaftServiceFactory.createRaftNode(raftId, new PeerId(endpoint, 0));
    final AsyncKeyValueStore keyValueStore = createStore(rawKVStore, node);
    final ScheduleMetaAdaptor scheduleMetaAdaptor = createScheduleMetaAdaptor(keyValueStore);
    final TableMetaAdaptor tableMetaAdaptor = createTableMetaAdaptor(keyValueStore, scheduleMetaAdaptor);
    final CoordinatorMetaService metaService = createMetaService();
    final RowStoreMetaAdaptor rowStoreMetaAdaptor = createRowStoreMetaAdaptor(scheduleMetaAdaptor);
    context.coordOpts(svrOpts).endpoint(endpoint).netService(createNetService()).rocksKVStore(rawKVStore).stateMachine(stateMachine).keyValueStore(keyValueStore).node(node).scheduleMetaAdaptor(scheduleMetaAdaptor).serviceProvider(createServiceProvider()).tableMetaAdaptor(tableMetaAdaptor).rowStoreMetaAdaptor(rowStoreMetaAdaptor).metaService(metaService);
    NodeManager.getInstance().addAddress(endpoint);
    stateMachine.init();
    final NodeOptions nodeOptions = initNodeOptions(stateMachine);
    node.init(nodeOptions);
    keyValueStore.init();
}
Also used : RowStoreMetaAdaptor(io.dingodb.server.coordinator.meta.RowStoreMetaAdaptor) CoordinatorStateMachine(io.dingodb.server.coordinator.state.CoordinatorStateMachine) Node(io.dingodb.raft.Node) RocksRawKVStore(io.dingodb.store.row.storage.RocksRawKVStore) ScheduleMetaAdaptor(io.dingodb.server.coordinator.meta.ScheduleMetaAdaptor) NodeOptions(io.dingodb.raft.option.NodeOptions) CoordinatorContext(io.dingodb.server.coordinator.context.CoordinatorContext) AsyncKeyValueStore(io.dingodb.server.coordinator.store.AsyncKeyValueStore) RaftAsyncKeyValueStore(io.dingodb.server.coordinator.store.RaftAsyncKeyValueStore) TableMetaAdaptor(io.dingodb.server.coordinator.meta.TableMetaAdaptor) Endpoint(io.dingodb.raft.util.Endpoint) CoordinatorMetaService(io.dingodb.server.coordinator.meta.service.CoordinatorMetaService) PeerId(io.dingodb.raft.entity.PeerId)

Aggregations

Node (io.dingodb.raft.Node)1 PeerId (io.dingodb.raft.entity.PeerId)1 NodeOptions (io.dingodb.raft.option.NodeOptions)1 Endpoint (io.dingodb.raft.util.Endpoint)1 CoordinatorContext (io.dingodb.server.coordinator.context.CoordinatorContext)1 RowStoreMetaAdaptor (io.dingodb.server.coordinator.meta.RowStoreMetaAdaptor)1 ScheduleMetaAdaptor (io.dingodb.server.coordinator.meta.ScheduleMetaAdaptor)1 TableMetaAdaptor (io.dingodb.server.coordinator.meta.TableMetaAdaptor)1 CoordinatorMetaService (io.dingodb.server.coordinator.meta.service.CoordinatorMetaService)1 CoordinatorStateMachine (io.dingodb.server.coordinator.state.CoordinatorStateMachine)1 AsyncKeyValueStore (io.dingodb.server.coordinator.store.AsyncKeyValueStore)1 RaftAsyncKeyValueStore (io.dingodb.server.coordinator.store.RaftAsyncKeyValueStore)1 RocksRawKVStore (io.dingodb.store.row.storage.RocksRawKVStore)1