Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL #52

Merged
merged 30 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
11d1668
refactor: add dependency of console module and move controllers into …
Lambert-Rao Jan 21, 2024
f81c0dd
fix: add logback config, fix application-dev.yml and move `</dependen…
Lambert-Rao Jan 21, 2024
d9cf419
FirstCommit
zzxxiansheng Jan 28, 2024
6bd0009
Merge remote-tracking branch 'eventmesh/dev' into dev
zzxxiansheng Jan 29, 2024
df369e7
remerge
zzxxiansheng Feb 1, 2024
1b82aad
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
3391325
first improve
zzxxiansheng Feb 1, 2024
c7da0b9
Merge remote-tracking branch 'origin/dev' into dev
zzxxiansheng Feb 1, 2024
0b17293
second improve
zzxxiansheng Feb 1, 2024
22b8528
third improve
zzxxiansheng Feb 1, 2024
edb4005
fourth improve
zzxxiansheng Feb 1, 2024
c030859
fourth improve
zzxxiansheng Feb 1, 2024
a6b5caa
fourth improve
zzxxiansheng Feb 1, 2024
92b2953
Update and rename EventmeshConsoleApplication.java to EventMeshDashbo…
zzxxiansheng Feb 5, 2024
6dcb360
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f5bf0d
rename this starter class file to EventMeshDashboardApplication
zzxxiansheng Feb 5, 2024
7f2e85b
change some resource file
zzxxiansheng Feb 5, 2024
b9718ed
improve name
zzxxiansheng Feb 5, 2024
b4ab687
improve name
zzxxiansheng Feb 5, 2024
bff80be
Modify the fields of the synchronized log table
zzxxiansheng Feb 5, 2024
e5765d0
improve name
zzxxiansheng Feb 5, 2024
390dd05
improve name
zzxxiansheng Feb 5, 2024
befb6ee
Merge remote-tracking branch 'origin/dev' into dev
Mar 3, 2024
ca26ec5
config basic function and config ,runtime,store,cluster sql
Mar 6, 2024
ab82d06
try to resolve build error
Mar 6, 2024
506023b
Merge branch 'apache:dev' into dev
zzxxiansheng Mar 6, 2024
886c754
Some changes in the specification
Mar 7, 2024
e6081f6
something rename
Mar 8, 2024
8b0db55
one sql update
Mar 8, 2024
3e01c42
tag something to do
Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
@Mapper
public interface ConnectionMapper {

@Select("select COUNT(*) from connection where cluster_id=#{clusterId}")
zzxxiansheng marked this conversation as resolved.
Show resolved Hide resolved
Integer selectConnectionNumByCluster(ConnectionEntity connectionEntity);

@Select("SELECT * FROM connection")
List<ConnectionEntity> selectAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface StoreMapper {
+ "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}"
+ ",#{startTimestamp},#{rack},#{status},#{endpointMap})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void addStorage(StoreEntity storeEntity);
void addStore(StoreEntity storeEntity);

@Update("UPDATE store SET is_delete=1 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}")
void deleteStoreByUnique(StoreEntity storeEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.springframework.stereotype.Service;

@Service
public class ConnectorConfigController {
public class ConnectorConfigService {

public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.stereotype.Service;

@Service
public class RuntimeConfigController {
public class RuntimeConfigService {

public List<ConfigEntity> getRuntimeConfigFromInstance(Long clusterId, String host) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.stereotype.Service;

@Service
public class StorageConfigController {
public class StoreConfigService {

public List<ConfigEntity> getStorageConfigFromInstance(Long clusterId, String storeId) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.stereotype.Service;

@Service
public class TopicConfigController {
public class TopicConfigService {

public List<ConfigEntity> getTopicConfigFromInstance(Long clusterId, String name) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigService;
import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;

import java.util.List;
Expand All @@ -29,14 +29,17 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* Synchronous DB To Instance
*/
@Service
public class SynchronousConnectorConfigDBToInstanceTask {
public class SyncConnectorConfigTask {

@Autowired
private ConnectorDataService connectorDataService;

@Autowired
private ConnectorConfigController connectorConfigController;
private ConnectorConfigService connectorConfigService;
@Autowired
private ConfigService configService;

Expand All @@ -45,7 +48,7 @@ public void synchronousConnectorConfig(Long clusterId) {
for (ConnectorEntity connectorEntity : connectorEntities) {

ConcurrentHashMap<String, String> connectorConfigMapFromInstance = this.configListToMap(
connectorConfigController.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));
connectorConfigService.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));

ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.RuntimeConfigController;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.RuntimeConfigService;
import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService;

import java.util.List;
Expand All @@ -30,14 +30,18 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* Synchronous DB To Instance
*/

@Service
public class SynchronousRuntimeConfigDBToInstanceTask {
public class SyncRuntimeConfigTask {

@Autowired
private RuntimeService runtimeService;

@Autowired
private RuntimeConfigController runtimeConfigController;
private RuntimeConfigService runtimeConfigService;

@Autowired
private ConfigService configService;
Expand All @@ -47,7 +51,7 @@ public void synchronousRuntimeConfig(Long clusterId) {
for (RuntimeEntity runtimeEntity : runtimeEntityList) {

ConcurrentHashMap<String, String> runtimeConfigMapFromInstance = this.configListToMap(
runtimeConfigController.getRuntimeConfigFromInstance(clusterId, runtimeEntity.getHost()));
runtimeConfigService.getRuntimeConfigFromInstance(clusterId, runtimeEntity.getHost()));

ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, runtimeEntity.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,67 +18,71 @@
package org.apache.eventmesh.dashboard.console.service.config.synchronous;

import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity;
import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.StorageConfigController;
import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.StoreConfigService;
import org.apache.eventmesh.dashboard.console.service.store.StoreService;

import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* Synchronous DB To Instance
*/

@Service
public class SynchronousStorageConfigDBToInstanceTask {
public class SyncStoreConfigTask {

@Autowired
private RuntimeService runtimeService;
private StoreService storeService;

@Autowired
private StorageConfigController storageConfigController;
private StoreConfigService storeConfigService;

@Autowired
private ConfigService configService;

public void synchronousRuntimeConfig(Long clusterId) {
List<RuntimeEntity> runtimeEntityList = runtimeService.getRuntimeByClusterId(clusterId);
for (RuntimeEntity runtimeEntity : runtimeEntityList) {
public void synchronousStoreConfig(Long clusterId) {
List<StoreEntity> storeEntityList = storeService.selectStoreByCluster(clusterId);
for (StoreEntity storeEntity : storeEntityList) {

ConcurrentHashMap<String, String> runtimeConfigMapFromInstance = this.configListToMap(
storageConfigController.getStorageConfigFromInstance(clusterId, runtimeEntity.getHost()));
ConcurrentHashMap<String, String> storeConfigMapFromInstance = this.configListToMap(
storeConfigService.getStorageConfigFromInstance(clusterId, storeEntity.getHost()));

ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, runtimeEntity.getId());
ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, storeEntity.getId());

ConcurrentHashMap<String, String> runtimeConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
ConcurrentHashMap<String, String> storeConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));

ConcurrentHashMap<String, String> updateConfigMap = new ConcurrentHashMap<>();

runtimeConfigMapFromInstance.entrySet().forEach(n -> {
if (runtimeConfigMapFromDb.remove(n.getKey(), n.getValue())) {
runtimeConfigMapFromInstance.remove(n.getKey());
storeConfigMapFromInstance.entrySet().forEach(n -> {
if (storeConfigMapFromDb.remove(n.getKey(), n.getValue())) {
storeConfigMapFromInstance.remove(n.getKey());
}
if (runtimeConfigMapFromDb.get(n.getKey()) != null) {
updateConfigMap.put(n.getKey(), runtimeConfigMapFromDb.get(n.getKey()));
runtimeConfigMapFromInstance.remove(n.getKey());
runtimeConfigMapFromDb.remove(n.getKey());
if (storeConfigMapFromDb.get(n.getKey()) != null) {
updateConfigMap.put(n.getKey(), storeConfigMapFromDb.get(n.getKey()));
storeConfigMapFromInstance.remove(n.getKey());
storeConfigMapFromDb.remove(n.getKey());
}
});
//add runtimeConfigMapFromDb
//add storeConfigMapFromDb

//update updateConfigMap

//delete runtimeConfigMapFromInstance
//delete storeConfigMapFromInstance
}
}

private ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
ConcurrentHashMap<String, String> runtimeConfigMap = new ConcurrentHashMap<>();
ConcurrentHashMap<String, String> storeConfigMap = new ConcurrentHashMap<>();
configEntityList.forEach(n -> {
runtimeConfigMap.put(n.getConfigName(), n.getConfigValue());
storeConfigMap.put(n.getConfigName(), n.getConfigValue());
}
);
return runtimeConfigMap;
return storeConfigMap;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity;
import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.TopicConfigController;
import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.TopicConfigService;
import org.apache.eventmesh.dashboard.console.service.topic.TopicService;

import java.util.List;
Expand All @@ -29,15 +29,18 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* Synchronous DB To Instance
*/

@Service
public class SynchronousTopicConfigDBToInstanceTask {
public class SyncTopicConfigTask {

@Autowired
private TopicService topicService;

@Autowired
private TopicConfigController topicConfigController;
private TopicConfigService topicConfigService;

@Autowired
private ConfigService configService;
Expand All @@ -47,7 +50,7 @@ public void synchronousTopicConfig(Long clusterId) {
for (TopicEntity topicEntity : topicEntityList) {

ConcurrentHashMap<String, String> topicConfigMapFromInstance = this.configListToMap(
topicConfigController.getTopicConfigFromInstance(clusterId, topicEntity.getTopicName()));
topicConfigService.getTopicConfigFromInstance(clusterId, topicEntity.getTopicName()));

ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, topicEntity.getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
import java.util.List;

/**
* Service providing data of connections.
* Service providing ConnectionEntity data.
*/
public interface ConnectionDataService {

Integer selectConnectionNumByCluster(Long clusterId);

List<ConnectionEntity> getAllConnections();

List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId);

void replaceAllConnections(List<ConnectionEntity> connectionEntityList);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,22 @@ public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService
@Autowired
private ConnectionMapper connectionMapper;


@Override
public List<ConnectionEntity> getAllConnectionsByClusterId(Long clusterId) {
ConnectionEntity connectionEntity = new ConnectionEntity();
connectionEntity.setClusterId(clusterId);
return connectionMapper.selectByClusterId(connectionEntity);
}


@Override
public Integer selectConnectionNumByCluster(Long clusterId) {
ConnectionEntity connectionEntity = new ConnectionEntity();
connectionEntity.setClusterId(clusterId);
return connectionMapper.selectConnectionNumByCluster(connectionEntity);
}

@Override
public List<ConnectionEntity> getAllConnections() {
return connectionMapper.selectAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

/**
* Service providing data of connectors.
* Service providing ConnectorEntity data.
*/
public interface ConnectorDataService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class StoreServiceImpl implements StoreService {
private StoreMapper storeMapper;

@Override
public void addStorage(StoreEntity storeEntity) {
storeMapper.addStorage(storeEntity);
public void addStore(StoreEntity storeEntity) {
storeMapper.addStore(storeEntity);
}

@Override
Expand All @@ -43,7 +43,9 @@ public void deleteStoreByUnique(StoreEntity storeEntity) {
}

@Override
public List<StoreEntity> selectStoreByCluster(StoreEntity storeEntity) {
public List<StoreEntity> selectStoreByCluster(Long clusterId) {
StoreEntity storeEntity = new StoreEntity();
storeEntity.setClusterId(clusterId);
return storeMapper.selectStoreByCluster(storeEntity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
*/
public interface StoreService {

void addStorage(StoreEntity storeEntity);
void addStore(StoreEntity storeEntity);

void deleteStoreByUnique(StoreEntity storeEntity);

List<StoreEntity> selectStoreByCluster(StoreEntity storeEntity);
List<StoreEntity> selectStoreByCluster(Long clusterId);

void updateStoreByUnique(StoreEntity storeEntity);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
* Service about Topic
*/
public interface TopicService {

Integer selectTopicNumByCluster(Long clusterId);

List<TopicEntity> getTopicList(TopicEntity topicEntity);

void addTopic(TopicEntity topicEntity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public class TopicServiceImpl implements TopicService {
OprGroupMemberMapper oprGroupMemberMapper;


@Override
public Integer selectTopicNumByCluster(Long clusterId) {
TopicEntity topicEntity = new TopicEntity();
topicEntity.setClusterId(clusterId);
return topicMapper.selectTopicNumByCluster(topicEntity);
}

@Override
public List<TopicEntity> getTopicList(TopicEntity topicEntity) {
return topicMapper.getTopicList(topicEntity);
Expand Down
Loading
Loading