Skip to content

Commit

Permalink
Merge branch 'refs/heads/v3.0-develop' into summer-ospp#12028-sync-de…
Browse files Browse the repository at this point in the history
…velop

# Conflicts:
#	auth/src/test/java/com/alibaba/nacos/auth/config/AuthConfigsTest.java
#	config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPublishRequestHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/ConfigOperationService.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpChangeConfigWorker.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpConfigHandler.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/DumpService.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/dump/processor/DumpAllProcessor.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/merge/MergeDatumService.java
#	config/src/test/java/com/alibaba/nacos/config/server/controller/v2/ConfigControllerV2Test.java
#	console/pom.xml
#	console/src/main/java/com/alibaba/nacos/console/config/ConsoleConfig.java
#	core/src/main/java/com/alibaba/nacos/core/auth/AuthFilter.java
#	core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java
#	core/src/main/java/com/alibaba/nacos/core/listener/StartingApplicationListener.java
#	core/src/main/resources/META-INF/logback/nacos.xml
#	core/src/test/java/com/alibaba/nacos/core/auth/AuthFilterTest.java
#	core/src/test/java/com/alibaba/nacos/core/cluster/ServerMemberManagerTest.java
#	distribution/conf/nacos-logback.xml
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/NacosAuthConfig.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/NacosAuthManager.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/authenticate/AuthenticationManagerDelegator.java
#	plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/filter/JwtAuthenticationTokenFilter.java
#	pom.xml
#	prometheus/src/main/java/com/alibaba/nacos/prometheus/conf/PrometheusSecurityConfiguration.java
  • Loading branch information
KomachiSion committed Jan 8, 2025
2 parents b16b900 + f5e0b13 commit 8738216
Show file tree
Hide file tree
Showing 619 changed files with 34,027 additions and 11,660 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Nacos (official site: [nacos.io](https://nacos.io)) is an easy-to-use platform designed for dynamic service discovery and configuration and service management. It helps you to build cloud native applications and microservices platform easily.

Service is a first-class citizen in Nacos. Nacos supports almost all type of services,for example,[Dubbo/gRPC service](https://nacos.io/en-us/docs/use-nacos-with-dubbo.html), [Spring Cloud RESTFul service](https://nacos.io/en-us/docs/use-nacos-with-springcloud.html) or [Kubernetes service](https://nacos.io/en-us/docs/use-nacos-with-kubernetes.html).
Service is a first-class citizen in Nacos. Nacos supports almost all type of services,for example,[Dubbo/gRPC service](https://nacos.io/docs/latest/ecology/use-nacos-with-dubbo/), [Spring Cloud RESTFul service](https://nacos.io/docs/latest/ecology/use-nacos-with-spring-cloud/) or [Kubernetes service](https://nacos.io/docs/latest/quickstart/quick-start-kubernetes/).

Nacos provides four major functions.

Expand Down Expand Up @@ -68,23 +68,23 @@ On the **Windows** platform, run the following command to start server with stan
startup.cmd -m standalone
```

For more details, see [quick-start.](https://nacos.io/en-us/docs/quick-start.html)
For more details, see [quick-start.](https://nacos.io/docs/latest/quickstart/quick-start/)

## Quick start for other open-source projects:
* [Quick start with Nacos command and console](https://nacos.io/en-us/docs/quick-start.html)
* [Quick start with Nacos command and console](https://nacos.io/docs/latest/quickstart/quick-start/)

* [Quick start with dubbo](https://nacos.io/en-us/docs/use-nacos-with-dubbo.html)
* [Quick start with dubbo](https://nacos.io/docs/latest/ecology/use-nacos-with-dubbo/)

* [Quick start with spring cloud](https://nacos.io/en-us/docs/quick-start-spring-cloud.html)
* [Quick start with spring cloud](https://nacos.io/docs/latest/ecology/use-nacos-with-spring-cloud/)

* [Quick start with kubernetes](https://nacos.io/en-us/docs/use-nacos-with-kubernetes.html)
* [Quick start with kubernetes](https://nacos.io/docs/latest/quickstart/quick-start-kubernetes/)


## Documentation

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

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

All the latest and long-term notice can also be found here from [GitHub notice issue](https://github.com/alibaba/nacos/labels/notice).

Expand Down
1 change: 0 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,5 @@
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

</dependencies>
</project>
13 changes: 13 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/NacosFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.alibaba.nacos.api.config.ConfigFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.lock.LockService;
import com.alibaba.nacos.api.lock.NacosLockFactory;
import com.alibaba.nacos.api.naming.NamingFactory;
import com.alibaba.nacos.api.naming.NamingMaintainFactory;
import com.alibaba.nacos.api.naming.NamingMaintainService;
Expand Down Expand Up @@ -98,4 +100,15 @@ public static NamingMaintainService createMaintainService(String serverAddr) thr
public static NamingMaintainService createMaintainService(Properties properties) throws NacosException {
return NamingMaintainFactory.createMaintainService(properties);
}

/**
* Create lock service.
*
* @param properties init param
* @return lock service
* @throws NacosException Exception
*/
public static LockService createLockService(Properties properties) throws NacosException {
return NacosLockFactory.createLockService(properties);
}
}
11 changes: 11 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class Constants {

public static final String CLIENT_VERSION_KEY = "ClientVersion";

public static final String CLIENT_IP = "ClientIp";

public static final String UNKNOWN_APP = "UnknownApp";

public static final String DEFAULT_DOMAINNAME = "commonconfig.config-host.taobao.com";
Expand Down Expand Up @@ -274,6 +276,15 @@ public static class Naming {
public static final String CMDB_CONTEXT_TYPE = "CMDB";
}

/**
* The constants in lock directory.
*/
public static class Lock {

public static final String LOCK_MODULE = "lock";

}

/**
* The constants in remote directory.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
* @version $Id: ConfigChangeClusterSyncRequest.java, v 0.1 2020年08月11日 4:30 PM liuzunfei Exp $
*/
public class ConfigChangeClusterSyncRequest extends AbstractConfigRequest {

String tag;


long lastModified;

String grayName;

@Deprecated
boolean isBeta;

boolean isBatch;
@Deprecated
String tag;

public boolean isBeta() {
return isBeta;
Expand All @@ -42,14 +44,6 @@ public void setBeta(boolean beta) {
isBeta = beta;
}

public boolean isBatch() {
return isBatch;
}

public void setBatch(boolean batch) {
isBatch = batch;
}

/**
* Getter method for property <tt>tag</tt>.
*
Expand All @@ -68,6 +62,14 @@ public void setTag(String tag) {
this.tag = tag;
}

public String getGrayName() {
return grayName;
}

public void setGrayName(String grayName) {
this.grayName = grayName;
}

/**
* Getter method for property <tt>lastModified</tt>.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class ConfigQueryResponse extends Response {

public static final int CONFIG_QUERY_CONFLICT = 400;

public static final int NO_RIGHT = 403;

String content;

String encryptedDataKey;
Expand Down
80 changes: 80 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/lock/LockService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* 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.lock;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.lock.model.LockInstance;

import java.util.Properties;

/**
* Nacos Lock Process.
*
* <p>lock => {@link LockService#lock(LockInstance)} -> {@link LockInstance#lock(LockService)} ->
* {@link LockService#remoteTryLock(LockInstance)} <br/> unLock => {@link LockService#unLock(LockInstance)} ->
* {@link LockInstance#unLock(LockService)} -> {@link LockService#remoteReleaseLock(LockInstance)}
*
* @author [email protected]
* @date 2023/8/24 19:49
*/
public interface LockService {

/**
* Real lock method expose to user to acquire the lock.<br/> It will call {@link LockInstance#lock(LockService)}
* <br/>
*
* @param instance instance
* @return Boolean
* @throws NacosException NacosException
*/
Boolean lock(LockInstance instance) throws NacosException;

/**
* Real lock method expose to user to release the lock.<br/> It will call {@link LockInstance#unLock(LockService)}
* <br/>
*
* @param instance instance
* @return Boolean
* @throws NacosException NacosException
*/
Boolean unLock(LockInstance instance) throws NacosException;

/**
* use grpc request to try lock.
*
* @param instance instance
* @return Boolean
* @throws NacosException NacosException
*/
Boolean remoteTryLock(LockInstance instance) throws NacosException;

/**
* use grpc request to release lock.
*
* @param instance instance
* @return Boolean
* @throws NacosException NacosException
*/
Boolean remoteReleaseLock(LockInstance instance) throws NacosException;

/**
* get properties.
*
* @return Properties
*/
Properties getProperties();
}
48 changes: 48 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/lock/NacosLockFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.lock;

import com.alibaba.nacos.api.exception.NacosException;

import java.lang.reflect.Constructor;
import java.util.Properties;

/**
* lock Factory.
*
* @author [email protected]
* @date 2023/8/25 0:40
*/
public class NacosLockFactory {

/**
* Create a new lock service.
*
* @param properties lock service properties
* @return new lock service
* @throws NacosException nacos exception
*/
public static LockService createLockService(Properties properties) throws NacosException {
try {
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.lock.NacosLockService");
Constructor constructor = driverImplClass.getConstructor(Properties.class);
return (LockService) constructor.newInstance(properties);
} catch (Throwable e) {
throw new NacosException(NacosException.CLIENT_INVALID_PARAM, e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.lock.common;

/**
* lock constant.
*
* @author [email protected]
* @date 2023/8/23 15:53
*/
public class LockConstants {

public static final String NACOS_LOCK_TYPE = "NACOS_LOCK";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.lock.constant;

/**
* lock properties constants.
* @author [email protected]
* @description PropertyConstants
* @date 2023/6/28 17:38
*/
public class PropertyConstants {
public static final String LOCK_REQUEST_TIMEOUT = "lockRequestTimeout";

public static final String LOCK_DEFAULT_WAIT_TIME = "nacos.lock.default_wait_time";

public static final Long LOCK_DEFAULT_WAIT_SECOND = 10_000L;
}
Loading

0 comments on commit 8738216

Please sign in to comment.