Skip to content

Commit

Permalink
Merge branch 'alibaba:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo-Qiu authored Nov 24, 2023
2 parents d9c4d7b + b50ccb0 commit 0d4efa1
Show file tree
Hide file tree
Showing 692 changed files with 27,933 additions and 18,106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
- name: "Codecov"
uses: codecov/[email protected]
with:
files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./plugin-default-impl/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml
files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./persistence/target/site/jacoco/jacoco.xml,./plugin-default-impl/nacos-default-auth-plugin/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/config/target/site/jacoco/jacoco.xml,./plugin/control/target/site/jacoco/jacoco.xml,./plugin/datasource/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./plugin/environment/target/site/jacoco/jacoco.xml,./plugin/trace/target/site/jacoco/jacoco.xml,./prometheus/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml
2 changes: 1 addition & 1 deletion .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: Upload distribution tar
with:
name: nacos
path: distribution/target/nacos-server-*-SNAPSHOT.tar.gz
path: distribution/target/nacos-server-*.tar.gz
- name: Save PR number
run: |
mkdir -p ./pr
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Build and save docker images
id: build-images
run: |
mv nacos-server-*-SNAPSHOT.tar.gz nacos-e2e/cicd/build
mv nacos-server-*.tar.gz nacos-e2e/cicd/build
cd nacos-e2e/cicd/build
version=${{ github.event.pull_request.number || github.ref_name }}-$(uuidgen)
mkdir versionlist
Expand Down Expand Up @@ -171,9 +171,9 @@ jobs:
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
test-code-git: "https://github.com/nacos-group/nacos-e2e.git"
test-code-branch: "master"
test-code-branch: "main"
test-code-path: "java/nacos-2X"
test-cmd: 'mvn clean test -B -Dnacos.client.version=2.2.3'
test-cmd: 'mvn clean test -B'
job-id: ${{ strategy.job-index }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
name: Upload distribution tar
with:
name: nacos
path: distribution/target/nacos-server-*-SNAPSHOT.tar.gz
path: distribution/target/nacos-server-*.tar.gz

docker:
if: ${{ success() }}
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Build and save docker images
id: build-images
run: |
mv nacos-server-*-SNAPSHOT.tar.gz nacos-e2e/cicd/build/
mv nacos-server-*.tar.gz nacos-e2e/cicd/build/
cd nacos-e2e/cicd/build
version=${{ github.event.pull_request.number || github.ref_name }}-$(uuidgen)
mkdir versionlist
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
test-code-git: "https://github.com/nacos-group/nacos-e2e.git"
test-code-branch: "main"
test-code-path: "java/nacos-2X"
test-cmd: 'mvn clean test -B -Dnacos.client.version=2.2.3'
test-cmd: 'mvn clean test -B'
job-id: ${{ strategy.job-index }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ For more details, see [quick-start.](https://nacos.io/en-us/docs/quick-start.htm

## Documentation

You can view the full documentation from the [Nacos website](https://nacos.io/en-us/docs/what-is-nacos.html).
You can view the full documentation from the [Nacos website](https://nacos.io/en-us/docs/v2/what-is-nacos.html).

You can also read this online eBook from the [NACOS ARCHITECTURE & PRINCIPLES](https://www.yuque.com/nacos/ebook/kbyo6n).

Expand Down
4 changes: 4 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/PropertyKeyConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public class PropertyKeyConst {

public static final String NAMING_ASYNC_QUERY_SUBSCRIBE_SERVICE = "namingAsyncQuerySubscribeService";

public static final String REDO_DELAY_TIME = "redoDelayTime";

public static final String REDO_DELAY_THREAD_COUNT = "redoDelayThreadCount";

/**
* Get the key value of some variable value from the system property.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @author liuzunfei
* @version $Id: ClientAbilities.java, v 0.1 2021年01月24日 00:09 AM liuzunfei Exp $
*/
@Deprecated
public class ClientAbilities implements Serializable {

private static final long serialVersionUID = -3590789441404549261L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @author liuzunfei
* @version $Id: ServerAbilities.java, v 0.1 2021年01月24日 00:09 AM liuzunfei Exp $
*/
@Deprecated
public class ServerAbilities implements Serializable {

private static final long serialVersionUID = -2120543002911304171L;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed 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 com.alibaba.nacos.api.ability.constant;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.HashMap;
import java.util.stream.Collectors;

/**
* Ability key constant. It is used to constrain the ability key.<br/>
* <strong>Ensure that return value of {@link AbilityKey#getName()} is unique under one specify {@link AbilityMode}</strong>.
*
* @author Daydreamer
* @date 2022/8/31 12:27
**/
public enum AbilityKey {

/**
* For Test temporarily.
*/
SERVER_TEST_1("test_1", "just for junit test", AbilityMode.SERVER),

/**
* For Test temporarily.
*/
SERVER_TEST_2("test_2", "just for junit test", AbilityMode.SERVER),

/**
* For Test temporarily.
*/
SDK_CLIENT_TEST_1("test_1", "just for junit test", AbilityMode.SDK_CLIENT),

/**
* For Test temporarily.
*/
CLUSTER_CLIENT_TEST_1("test_1", "just for junit test", AbilityMode.CLUSTER_CLIENT);

/**
* the name of a certain ability.
*/
private final String keyName;

/**
* description or comment about this ability.
*/
private final String description;

/**
* ability mode, which endpoint hold this ability.
*/
private final AbilityMode mode;

AbilityKey(String keyName, String description, AbilityMode mode) {
this.keyName = keyName;
this.description = description;
this.mode = mode;
}

public String getName() {
return keyName;
}

public String getDescription() {
return description;
}

public AbilityMode getMode() {
return mode;
}

/**
* All key set.
*/
private static final Map<AbilityMode, Map<String, AbilityKey>> ALL_ABILITIES = new HashMap<>();

/**
* Get all keys.
*
* @return all keys
*/
public static Collection<AbilityKey> getAllValues(AbilityMode mode) {
return Collections.unmodifiableCollection(ALL_ABILITIES.get(mode).values());
}

/**
* Get all names.
*
* @return all names
*/
public static Collection<String> getAllNames(AbilityMode mode) {
return Collections.unmodifiableCollection(ALL_ABILITIES.get(mode).keySet());
}

/**
* Whether contains this name.
*
* @param name key name
* @return whether contains
*/
public static boolean isLegalKey(AbilityMode mode, String name) {
return ALL_ABILITIES.get(mode).containsKey(name);
}

/**
* Map the string key to enum.
*
* @param abilities map
* @return enum map
*/
public static Map<AbilityKey, Boolean> mapEnum(AbilityMode mode, Map<String, Boolean> abilities) {
if (abilities == null || abilities.isEmpty()) {
return Collections.emptyMap();
}
return abilities.entrySet()
.stream()
.filter(entry -> isLegalKey(mode, entry.getKey()))
.collect(Collectors.toMap((entry) -> getEnum(mode, entry.getKey()), Map.Entry::getValue));
}

/**.
* Map the string key to enum
*
* @param abilities map
* @return enum map
*/
public static Map<String, Boolean> mapStr(Map<AbilityKey, Boolean> abilities) {
if (abilities == null || abilities.isEmpty()) {
return Collections.emptyMap();
}
return abilities.entrySet()
.stream()
.collect(Collectors.toMap((entry) -> entry.getKey().getName(), Map.Entry::getValue));
}

/**.
* getter to obtain enum
*
* @param key string key
* @return enum
*/
public static AbilityKey getEnum(AbilityMode mode, String key) {
return ALL_ABILITIES.get(mode).get(key);
}

static {
// check for developer
// ensure that name filed is unique under a AbilityMode
try {
for (AbilityKey value : AbilityKey.values()) {
AbilityMode mode = value.getMode();
Map<String, AbilityKey> map = ALL_ABILITIES.getOrDefault(mode, new HashMap<>());
AbilityKey previous = map.putIfAbsent(value.getName(), value);
if (previous != null) {
throw new IllegalStateException("Duplicate key name field " + value + " and " + previous + " under mode: " + mode);
}
ALL_ABILITIES.put(mode, map);
}
} catch (Throwable t) {
// for developer checking
t.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 1999-2023 Alibaba Group Holding Ltd.
*
* Licensed 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 com.alibaba.nacos.api.ability.constant;

/**
* Ability mode.
*
* @author Daydreamer
* @date 2023/9/25 12:32
**/
public enum AbilityMode {

/**
* for server ability.
*/
SERVER,

/**
* for sdk client.
*/
SDK_CLIENT,

/**
* for cluster client.
*/
CLUSTER_CLIENT;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 1999-2022 Alibaba Group Holding Ltd.
*
* Licensed 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 com.alibaba.nacos.api.ability.constant;

/**.
* @author Daydreamer
* @description It is used to know a certain ability whether supporting.
* @date 2022/8/31 12:27
**/
public enum AbilityStatus {

/**.
* Support a certain ability
*/
SUPPORTED,

/**.
* Not support a certain ability
*/
NOT_SUPPORTED,

/**.
* Cannot find ability table, unknown
*/
UNKNOWN
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*
* @author xiweng.yy
*/
@Deprecated
public interface AbilityInitializer<A> {

/**
Expand Down
Loading

0 comments on commit 0d4efa1

Please sign in to comment.