Search in sources :

Example 1 with ExecutorView

use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.

the class RowStoreMetaAdaptorImpl method mapping.

public ExecutorView mapping(Store store) {
    if (store == null) {
        return null;
    }
    GeneralId generalId = GeneralId.fromStr(store.getId());
    ExecutorView view = new ExecutorView(generalId, store.getEndpoint());
    store.getRegions().stream().map(Region::getId).map(GeneralIdHelper::region).forEach(view::addApp);
    return view;
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView) Region(io.dingodb.store.row.metadata.Region) GeneralId(io.dingodb.server.coordinator.GeneralId)

Example 2 with ExecutorView

use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.

the class RowStoreMetaAdaptorImpl method saveStore.

@Override
public void saveStore(Store store) {
    GeneralId id = GeneralId.fromStr(store.getId());
    ExecutorView view = mapping(store);
    scheduleMetaAdaptor.updateExecutorView(view);
    storeMap.put(id, store);
    endpointStoreId.put(store.getEndpoint(), id);
    storeRegion.put(id, store.getRegions().stream().map(Region::getId).map(GeneralIdHelper::region).collect(Collectors.toCollection(ConcurrentHashSet::new)));
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView) ConcurrentHashSet(com.alipay.remoting.util.ConcurrentHashSet) GeneralIdHelper(io.dingodb.server.coordinator.meta.GeneralIdHelper) GeneralId(io.dingodb.server.coordinator.GeneralId)

Example 3 with ExecutorView

use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.

the class RowStoreMetaAdaptorImpl method mapping.

public Store mapping(ExecutorView executorView) {
    if (executorView == null) {
        return null;
    }
    Store store = new Store();
    store.setEndpoint(new Endpoint(executorView.location().getHost(), executorView.location().getPort()));
    store.setId(executorView.resourceId().toString());
    store.setLabels(executorView.labels().entrySet().stream().map(e -> new StoreLabel(e.getKey(), e.getValue())).collect(Collectors.toList()));
    store.setRegions(executorView.apps().stream().map(id -> scheduleMetaAdaptor.namespace().<RegionApp>getApp(id)).map(this::mapping).collect(Collectors.toList()));
    return store;
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView) StoreStats(io.dingodb.store.row.metadata.StoreStats) GeneralId(io.dingodb.server.coordinator.GeneralId) RegionView(io.dingodb.server.coordinator.app.impl.RegionView) StoreLabel(io.dingodb.store.row.metadata.StoreLabel) BigDecimal(java.math.BigDecimal) RowStoreMetaAdaptor(io.dingodb.server.coordinator.meta.RowStoreMetaAdaptor) Map(java.util.Map) Optional(io.dingodb.common.util.Optional) RegionEpoch(io.dingodb.store.row.metadata.RegionEpoch) Store(io.dingodb.store.row.metadata.Store) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Region(io.dingodb.store.row.metadata.Region) Set(java.util.Set) GeneralIdHelper(io.dingodb.server.coordinator.meta.GeneralIdHelper) Peer(io.dingodb.store.row.metadata.Peer) Collectors(java.util.stream.Collectors) Cluster(io.dingodb.store.row.metadata.Cluster) ScheduleMetaAdaptor(io.dingodb.server.coordinator.meta.ScheduleMetaAdaptor) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) ConcurrentHashSet(com.alipay.remoting.util.ConcurrentHashSet) RegionStats(io.dingodb.store.row.metadata.RegionStats) RegionApp(io.dingodb.server.coordinator.app.impl.RegionApp) Endpoint(io.dingodb.raft.util.Endpoint) StoreLabel(io.dingodb.store.row.metadata.StoreLabel) Endpoint(io.dingodb.raft.util.Endpoint) Store(io.dingodb.store.row.metadata.Store) RegionApp(io.dingodb.server.coordinator.app.impl.RegionApp)

Example 4 with ExecutorView

use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.

the class ScheduleMetaAdaptorImpl method newExecutorView.

private ExecutorView newExecutorView(GeneralId id, Endpoint endpoint) {
    ExecutorView view = new ExecutorView(id, endpoint);
    updateExecutorView(view);
    if (log.isDebugEnabled()) {
        log.debug("Create executor view for id and endpoint, id: [{}], endpoint: [{}]", id, endpoint);
    }
    return view;
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView)

Example 5 with ExecutorView

use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.

the class RowStoreMetaAdaptorImpl method saveStoreStats.

@Override
public void saveStoreStats(StoreStats storeStats) {
    GeneralId id = GeneralId.fromStr(storeStats.getStoreId());
    ExecutorView view = scheduleMetaAdaptor.executorView(id);
    view.stats(storeStats);
    scheduleMetaAdaptor.updateExecutorView(view);
    storeStatsMap.put(id, storeStats);
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView) GeneralId(io.dingodb.server.coordinator.GeneralId)

Aggregations

ExecutorView (io.dingodb.server.coordinator.resource.impl.ExecutorView)6 GeneralId (io.dingodb.server.coordinator.GeneralId)5 ConcurrentHashSet (com.alipay.remoting.util.ConcurrentHashSet)2 Endpoint (io.dingodb.raft.util.Endpoint)2 RegionApp (io.dingodb.server.coordinator.app.impl.RegionApp)2 RegionView (io.dingodb.server.coordinator.app.impl.RegionView)2 GeneralIdHelper (io.dingodb.server.coordinator.meta.GeneralIdHelper)2 Region (io.dingodb.store.row.metadata.Region)2 Map (java.util.Map)2 Optional (io.dingodb.common.util.Optional)1 Location (io.dingodb.meta.Location)1 LocationGroup (io.dingodb.meta.LocationGroup)1 AppView (io.dingodb.server.coordinator.app.AppView)1 RowStoreMetaAdaptor (io.dingodb.server.coordinator.meta.RowStoreMetaAdaptor)1 ScheduleMetaAdaptor (io.dingodb.server.coordinator.meta.ScheduleMetaAdaptor)1 Cluster (io.dingodb.store.row.metadata.Cluster)1 Peer (io.dingodb.store.row.metadata.Peer)1 RegionEpoch (io.dingodb.store.row.metadata.RegionEpoch)1 RegionStats (io.dingodb.store.row.metadata.RegionStats)1 Store (io.dingodb.store.row.metadata.Store)1