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();
}
Aggregations