-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* cache: Use cache to store cluster and runtime in the database because they are frequently used. * remove HealthCheckConfig, it's useless * entities modified * mappers modified * data services(dao) modified * models: use @SuperBuilder to support builder from father * feat: add Nacos Runtime Remoting service and its implementation. this service can get runtime info from nacos * remoting service modify * refactor: let redis check use SDK manager * refactor: let rocketmq check use SDK manager * fix & docs: health check module; Optimize operation logic * sql small modifies, remove redundant fields, add needed fields, and renames * nacos get runtime check * test resources, they insert test data before test * feat: add metadata manager who take control of the process of data synchronization from remote cluster to database. * test resources, they insert test data before test * feat: add Sync Service. They get data from source(mostly cluster). * feat: add converter, which is used to convert from metadata type into entity type * feat: add handler, they insert new data into database * feat: add FunctionManager, it manages all sub functions, like health check and sync data service. * test: metadata * feat: add meta controller, the entrance of a new cluster * application property * test: cache and application * feat: data service wrapper. A collection of DAOs. * feat: data runtime interface model * feat: newMetaDTO * feat: topic interface to insert data into cluster * fix: fix a typo in sql * fix: get runtimes by 3 protocols from meta * fix: move functions from FunctionManager into HealthService and MetadataManager * refactor: remove converter * chore: use log level info to get less log * fix: remove a test that leads to the fail of github test * fix: get runtime by cluster from database * fix: remove meta controller * fix: let null password not fail health check * fix: add time limit to avoid block * fix: add time limit to SDK related tests * fix: add try catch block on health check unit tests --------- Co-authored-by: Pil0tXia <[email protected]>
- Loading branch information
1 parent
4494f0a
commit 53785bf
Showing
154 changed files
with
4,647 additions
and
762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...oard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.cache; | ||
|
||
|
||
import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import lombok.Getter; | ||
|
||
public class ClusterCache { | ||
|
||
@Getter | ||
private static final ClusterCache INSTANCE = new ClusterCache(); | ||
|
||
//cluster name | ||
private HashMap<String, ClusterEntity> clusterNameMap = new HashMap<>(); | ||
|
||
private HashMap<Long, ClusterEntity> clusterIdMap = new HashMap<>(); | ||
|
||
private static final Object lock = new Object(); | ||
|
||
public ClusterEntity getClusterById(Long id) { | ||
return INSTANCE.clusterIdMap.get(id); | ||
} | ||
|
||
public ClusterEntity getClusterByName(String name) { | ||
return INSTANCE.clusterNameMap.get(name); | ||
} | ||
|
||
public ClusterEntity getClusterByRegistryAddress(String registryAddress) { | ||
for (ClusterEntity clusterEntity : INSTANCE.clusterIdMap.values()) { | ||
if (clusterEntity.getRegistryAddress().equals(registryAddress)) { | ||
return clusterEntity; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public List<ClusterEntity> getClusters() { | ||
return new ArrayList<>(INSTANCE.clusterIdMap.values()); | ||
} | ||
|
||
public void addCluster(ClusterEntity clusterEntity) { | ||
synchronized (lock) { | ||
if (INSTANCE.clusterIdMap.containsKey(clusterEntity.getId()) | ||
|| INSTANCE.clusterNameMap.containsKey(clusterEntity.getName())) { | ||
return; | ||
} | ||
INSTANCE.clusterIdMap.put(clusterEntity.getId(), clusterEntity); | ||
INSTANCE.clusterNameMap.put(clusterEntity.getName(), clusterEntity); | ||
} | ||
} | ||
|
||
public void deleteClusterById(Long id) { | ||
synchronized (lock) { | ||
ClusterEntity clusterEntity = INSTANCE.clusterIdMap.get(id); | ||
INSTANCE.clusterIdMap.remove(id); | ||
INSTANCE.clusterNameMap.remove(clusterEntity.getName()); | ||
} | ||
} | ||
|
||
public void deleteClusterByName(String name) { | ||
synchronized (lock) { | ||
ClusterEntity clusterEntity = INSTANCE.clusterNameMap.get(name); | ||
INSTANCE.clusterNameMap.remove(name); | ||
INSTANCE.clusterIdMap.remove(clusterEntity.getId()); | ||
} | ||
} | ||
|
||
public void syncClusters(List<ClusterEntity> clusters) { | ||
synchronized (lock) { | ||
INSTANCE.clusterIdMap.clear(); | ||
INSTANCE.clusterNameMap.clear(); | ||
for (ClusterEntity clusterEntity : clusters) { | ||
INSTANCE.clusterIdMap.put(clusterEntity.getId(), clusterEntity); | ||
INSTANCE.clusterNameMap.put(clusterEntity.getName(), clusterEntity); | ||
} | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...oard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.cache; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class RuntimeCache { | ||
|
||
private static final RuntimeCache INSTANCE = new RuntimeCache(); | ||
|
||
public static final RuntimeCache getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
// ip:port -> runtime | ||
private Map<String, RuntimeEntity> runtimeMap = new ConcurrentHashMap<>(); | ||
|
||
private RuntimeCache() { | ||
} | ||
|
||
public void addRuntime(RuntimeEntity runtimeEntity) { | ||
runtimeMap.put(runtimeEntity.getHost() + ":" + runtimeEntity.getPort(), runtimeEntity); | ||
} | ||
|
||
public Collection<RuntimeEntity> getRuntimeList() { | ||
return runtimeMap.values(); | ||
} | ||
|
||
public void deleteRuntime(RuntimeEntity runtimeEntity) { | ||
runtimeMap.remove(runtimeEntity.getHost() + ":" + runtimeEntity.getPort()); | ||
} | ||
|
||
public void replaceAllRuntime(List<RuntimeEntity> runtimeEntities) { | ||
Map<String, RuntimeEntity> newRuntimeList = new ConcurrentHashMap<>(); | ||
runtimeEntities.forEach(runtimeEntity -> { | ||
newRuntimeList.put(runtimeEntity.getHost() + ":" + runtimeEntity.getPort(), runtimeEntity); | ||
}); | ||
runtimeMap = newRuntimeList; | ||
} | ||
} |
Oops, something went wrong.