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

Refactor RemotingService and SyncFrom... interfaces #146

Merged
merged 14 commits into from
Jun 12, 2024
  •  
  •  
  •  
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ docker build -t yourname/eventmesh-dashboard -f docker/Dockerfile .

```
docker run -d --name eventmesh-dashboard -p 8080:8080 yourname/eventmesh-dashboard
```
```
9 changes: 9 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,12 @@ docker build -t yourname/eventmesh-dashboard -f docker/Dockerfile .
```
docker run -d --name eventmesh-dashboard -p 8080:8080 yourname/eventmesh-dashboard
```

### 开发准备
1. 配置格式化
1. 后端格式文档地址:https://eventmesh.apache.org/zh/community/contribute/contribute/
2. 前端使用 eslint
2. 配置协议头工具 license-eye。
1. 检查命令:license-eye header check
2. 使用命令:license-eye header fix
3. 下载地址: https://skywalking.apache.org/downloads/
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.eventmesh.dashboard.common.constant;

public class ApiPrefix {

public static final String API_PREFIX = "/eventmesh-dashboard/";

public static final String API_V1_PREFIX = API_PREFIX + "v1/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.eventmesh.dashboard.common.constant;

public class StoreTypeConstant {

public static final String STORE_TYPE_TYPE_UNKNOWN = "unknown";
public static final String STORE_TYPE_STANDALONE = "standalone";
public static final String STORE_TYPE_REDIS = "redis";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.eventmesh.dashboard.common.constant.health;

public class HealthConstant {

public static final String NEW_LINE_ENDING = "\n";

public static final String RUNTIME_CHECK_TOPIC = "eventmesh-dashboard-healthcheck-topic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public static <T> Result<T> success(T data) {
}

/**
* The request is valid and the result is returned in {@link ResponseEntity}.
* Logic issues should use 422 Unprocessable Entity instead of 200 OK.
* The request is valid and the result is returned in {@link ResponseEntity}. Logic issues should use 422 Unprocessable Entity instead of 200 OK.
*/
public static <T> ResponseEntity<Result<T>> ok() {
return ResponseEntity.ok(new Result<>(new StatusMessage(Status.SUCCESS)));
Expand Down Expand Up @@ -126,8 +125,7 @@ public StatusMessage(BaseException e) {
}

/**
* Only recommended for returning successful results,
* the stack trace cannot be displayed when returning unsuccessful results.
* Only recommended for returning successful results, the stack trace cannot be displayed when returning unsuccessful results.
*/
public StatusMessage(Status status) {
this.status = status.name();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.common.enums;

/**
* 业务类型,
* storage:可选值(rocketmq,pravega,mongodb,pulsar,redis,kafka,knative,rabbitmq),
* sinkConnector:可选值(rocketmq,spring,pravega,wechat,openfunction,file,knative,pulsar,lark,slack,rabbitmq,redis,mongodb,dingtalk)
* sourceConnector:可选值(rocketmq,spring,pravega,openfunction,jdbc,file,http,wecom,knative,pulsar,prometheus,rabbitmq,redis,mongodb)',
*/
public enum BusinessType {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.common.enums;

public enum ClusterTrusteeshipType {

FIRE_AND_FORGET_TRUSTEESHIP,

TRUSTEESHIP,

REVERSE,

NO_TRUSTEESHIP;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* 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.common.enums;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import lombok.Getter;

public enum ClusterType {

DEFAULT(1),

EVENTMESH(20),

STORAGE(21),

DEFAULT_TYPE_NAME(1),

CLUSTER(1),

META(2),

RUNTIME(3),


RUNTIME_EVENT_RUNTIME(ClusterType.META.code + 1),

RUNTIME_ROCKETMQ_BROKER(ClusterType.META.code + 31),

META_TYPE_ETCD(ClusterType.META.code + 1),

META_TYPE_NACOS(ClusterType.META.code + 2),

META_TYPE_ROCKETMQ_NAMESERVER(ClusterType.META.code + 31),


EVENTMESH_CLUSTER(EVENTMESH, EVENTMESH, CLUSTER, DEFAULT, RemotingType.EVENT_MESH_RUNTIME),

EVENTMESH_RUNTIME(EVENTMESH, EVENTMESH, RUNTIME, DEFAULT, RemotingType.EVENT_MESH_RUNTIME),

EVENTMESH_META_ETCD(EVENTMESH, EVENTMESH, META, META_TYPE_ETCD, RemotingType.EVENT_MESH_ETCD),

EVENTMESH_META_NACOS(EVENTMESH, EVENTMESH, META, META_TYPE_NACOS, RemotingType.EVENT_MESH_NACOS),

STORAGE_ROCKETMQ(ClusterType.STORAGE.code + 1),

STORAGE_ROCKETMQ_CLUSTER(STORAGE, STORAGE_ROCKETMQ, CLUSTER, DEFAULT, RemotingType.ROCKETMQ),

STORAGE_ROCKETMQ_NAMESERVER(STORAGE, STORAGE_ROCKETMQ, META, DEFAULT, RemotingType.ROCKETMQ_NAMESERVER),

STORAGE_ROCKETMQ_BROKER(STORAGE, STORAGE_ROCKETMQ, RUNTIME, DEFAULT, RemotingType.ROCKETMQ);


public static final List<ClusterType> STORAGE_TYPES = getStorage();
@Getter
private ClusterType eventmeshNodeType;
@Getter
private ClusterType assemblyName;
@Getter
private ClusterType assemblyNodeType;
@Getter
private ClusterType assemblyBusiness;
@Getter
private RemotingType remotingType;
@Getter
private int code;

ClusterType(int code) {
this.code = code;
}


ClusterType(ClusterType eventmeshNodeType, ClusterType assemblyName, ClusterType assemblyNodeType, ClusterType assemblyBusiness,
RemotingType remotingType) {
this.eventmeshNodeType = eventmeshNodeType;
this.assemblyName = assemblyName;
this.assemblyNodeType = assemblyNodeType;
this.assemblyBusiness = assemblyBusiness;
this.remotingType = remotingType;
}

private static List<ClusterType> getStorage() {
List<ClusterType> list = new ArrayList<>();
for (ClusterType clusterType : ClusterType.values()) {
if (Objects.equals(clusterType.eventmeshNodeType, ClusterType.STORAGE) && Objects.equals(clusterType.assemblyNodeType,
ClusterType.CLUSTER)) {
list.add(clusterType);
}
}
return list;
}

public boolean isMainCluster() {
return Objects.equals(this, ClusterType.EVENTMESH_CLUSTER) || Objects.equals(this.assemblyNodeType, ClusterType.CLUSTER);
}

public boolean isFirstLayer() {
return Objects.equals(this, ClusterType.EVENTMESH_META_NACOS) || Objects.equals(this, ClusterType.EVENTMESH_META_ETCD) || Objects.equals(this,
ClusterType.EVENTMESH_RUNTIME) || Objects.equals(this.getAssemblyNodeType(), ClusterType.CLUSTER);
}

public boolean isSecondFloor() {
return Objects.equals(eventmeshNodeType, ClusterType.STORAGE) ? (Objects.equals(assemblyNodeType, ClusterType.RUNTIME) || Objects.equals(
assemblyNodeType, ClusterType.META)) : false;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.common.enums;

public enum RemotingType {

NOT,

META,

STORAGE,

EVENT_MESH_RUNTIME,

EVENT_MESH_NACOS,

EVENT_MESH_ETCD,

ROCKETMQ,
ROCKETMQ_NAMESERVER;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.common.enums;

public enum ResetOffsetMode {

CONSUME_FROM_LAST_OFFSET,

CONSUME_FROM_FIRST_OFFSET,
CONSUME_FROM_TIMESTAMP,

CONSUME_FROM_DESIGNATED_OFFSET

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
package org.apache.eventmesh.dashboard.common.model.metadata;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class AclMetadata extends MetadataConfig {

private Long clusterId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
package org.apache.eventmesh.dashboard.common.model.metadata;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ClientMetadata extends MetadataConfig {

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@

package org.apache.eventmesh.dashboard.common.model.metadata;

import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType;
import org.apache.eventmesh.dashboard.common.enums.ClusterType;
import org.apache.eventmesh.dashboard.common.enums.StoreType;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ClusterMetadata extends MetadataConfig {

private String clusterName;

private ClusterTrusteeshipType trusteeshipType;

private ClusterType clusterType;

private String registryAddress;

private String bootstrapServers;
Expand Down
Loading
Loading