-
Notifications
You must be signed in to change notification settings - Fork 13k
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
* improvement: merge upstream/develop * style: format code style * style: modify pom.xml * fix: fix code style
- Loading branch information
1 parent
961f0d1
commit 9a44b92
Showing
137 changed files
with
9,080 additions
and
8,751 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,20 @@ | |
import java.util.Map; | ||
|
||
/** | ||
* Operation and maintenance command interface. | ||
* | ||
* @author <a href="mailto:[email protected]">liaochuntao</a> | ||
*/ | ||
public interface CommandOperations { | ||
|
||
/** | ||
* Operation and maintenance interface operation entry | ||
* | ||
* @param commands commands | ||
* @return execute success | ||
*/ | ||
default RestResult<String> execute(Map<String, String> commands) { | ||
return RestResultUtils.success(); | ||
} | ||
|
||
/** | ||
* Operation and maintenance interface operation entry. | ||
* | ||
* @param commands commands | ||
* @return execute success | ||
*/ | ||
default RestResult<String> execute(Map<String, String> commands) { | ||
return RestResultUtils.success(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,83 +17,80 @@ | |
package com.alibaba.nacos.consistency; | ||
|
||
import java.io.Serializable; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* Consistent protocol related configuration objects | ||
* Consistent protocol related configuration objects. | ||
* | ||
* {@link LogProcessor} : The consistency protocol provides services for all businesses, | ||
* but each business only cares about the transaction information belonging to that business, | ||
* and the transaction processing between the various services should not block each other. Therefore, | ||
* the LogProcessor is abstracted to implement the parallel processing of transactions of different services. | ||
* Corresponding LogProcessor sub-interface: LogProcessor4AP or LogProcessor4CP, different consistency | ||
* protocols will actively discover the corresponding LogProcessor | ||
* <p>{@link LogProcessor} : The consistency protocol provides services for all businesses, but each business only cares | ||
* about the transaction information belonging to that business, and the transaction processing between the various | ||
* services should not block each other. Therefore, the LogProcessor is abstracted to implement the parallel processing | ||
* of transactions of different services. Corresponding LogProcessor sub-interface: LogProcessor4AP or LogProcessor4CP, | ||
* different consistency protocols will actively discover the corresponding LogProcessor | ||
* | ||
* @author <a href="mailto:[email protected]">liaochuntao</a> | ||
*/ | ||
public interface Config<L extends LogProcessor> extends Serializable { | ||
|
||
/** | ||
* Set the cluster node information to initialize,like [ip:port, ip:port, ip:port] | ||
* Set the cluster node information to initialize,like [ip:port, ip:port, ip:port]. | ||
* | ||
* @param self local node address information, ip:port | ||
* @param members {@link Set<String>} | ||
* @param self local node address information, ip:port | ||
* @param members {@link Set} | ||
*/ | ||
void setMembers(String self, Set<String> members); | ||
|
||
/** | ||
* members join | ||
* members join. | ||
* | ||
* @param members {@link Set<String>} | ||
* @param members {@link Set} | ||
*/ | ||
void addMembers(Set<String> members); | ||
|
||
/** | ||
* members leave | ||
* members leave. | ||
* | ||
* @param members {@link Set<String>} | ||
* @param members {@link Set} | ||
*/ | ||
void removeMembers(Set<String> members); | ||
|
||
/** | ||
* get local node address info | ||
* get local node address info. | ||
* | ||
* @return address | ||
*/ | ||
String getSelfMember(); | ||
|
||
/** | ||
* get the cluster node information | ||
* get the cluster node information. | ||
* | ||
* @return members info, like [ip:port, ip:port, ip:port] | ||
*/ | ||
Set<String> getMembers(); | ||
|
||
/** | ||
* Add configuration content | ||
* Add configuration content. | ||
* | ||
* @param key config key | ||
* @param value config value | ||
*/ | ||
void setVal(String key, String value); | ||
|
||
/** | ||
* get configuration content by key | ||
* get configuration content by key. | ||
* | ||
* @param key config key | ||
* @return config value | ||
*/ | ||
String getVal(String key); | ||
|
||
/** | ||
* get configuration content by key, if not found, use default-val | ||
* get configuration content by key, if not found, use default-val. | ||
* | ||
* @param key config key | ||
* @param defaultVal default value | ||
* @return config value | ||
*/ | ||
String getValOfDefault(String key, String defaultVal); | ||
|
||
} |
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 |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
|
||
package com.alibaba.nacos.consistency; | ||
|
||
|
||
import com.alibaba.nacos.consistency.entity.GetRequest; | ||
import com.alibaba.nacos.consistency.entity.Log; | ||
import com.alibaba.nacos.consistency.entity.Response; | ||
|
@@ -26,8 +25,7 @@ | |
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* Has nothing to do with the specific implementation of the consistency protocol | ||
* Initialization sequence: init(Config) | ||
* Has nothing to do with the specific implementation of the consistency protocol Initialization sequence: init(Config). | ||
* | ||
* <ul> | ||
* <li>{@link Config} : Relevant configuration information required by the consistency protocol, | ||
|
@@ -40,79 +38,79 @@ | |
* @author <a href="mailto:[email protected]">liaochuntao</a> | ||
*/ | ||
public interface ConsistencyProtocol<T extends Config, P extends LogProcessor> extends CommandOperations { | ||
|
||
/** | ||
* Consistency protocol initialization: perform initialization operations based on the incoming Config | ||
* 一致性协议初始化,根据 Config 实现类 | ||
* Consistency protocol initialization: perform initialization operations based on the incoming. | ||
* Config 一致性协议初始化,根据Config 实现类 | ||
* | ||
* @param config {@link Config} | ||
*/ | ||
void init(T config); | ||
|
||
/** | ||
* Add a log handler | ||
* Add a log handler. | ||
* | ||
* @param processors {@link LogProcessor} | ||
*/ | ||
void addLogProcessors(Collection<P> processors); | ||
|
||
/** | ||
* Copy of metadata information for this consensus protocol | ||
* Copy of metadata information for this consensus protocol. | ||
* 该一致性协议的元数据信息 | ||
* | ||
* @return metaData {@link ProtocolMetaData} | ||
*/ | ||
ProtocolMetaData protocolMetaData(); | ||
|
||
/** | ||
* Obtain data according to the request | ||
* Obtain data according to the request. | ||
* | ||
* @param request request | ||
* @return data {@link Response} | ||
* @throws Exception | ||
* @throws Exception {@link Exception} | ||
*/ | ||
Response getData(GetRequest request) throws Exception; | ||
|
||
/** | ||
* Get data asynchronously | ||
* Get data asynchronously. | ||
* | ||
* @param request request | ||
* @return data {@link CompletableFuture<Response>} | ||
* @return data {@link CompletableFuture} | ||
*/ | ||
CompletableFuture<Response> aGetData(GetRequest request); | ||
|
||
/** | ||
* Data operation, returning submission results synchronously | ||
* Data operation, returning submission results synchronously. | ||
* 同步数据提交,在 Datum 中已携带相应的数据操作信息 | ||
* | ||
* @param data {@link Log} | ||
* @return submit operation result {@link Response} | ||
* @throws Exception | ||
* @throws Exception {@link Exception} | ||
*/ | ||
Response submit(Log data) throws Exception; | ||
|
||
/** | ||
* Data submission operation, returning submission results asynchronously | ||
* 异步数据提交,在 Datum 中已携带相应的数据操作信息,返回一个Future,自行操作,提交发生的异常会在CompleteFuture中 | ||
* Data submission operation, returning submission results asynchronously. | ||
* 异步数据提交,在 Datum中已携带相应的数据操作信息,返回一个Future,自行操作,提交发生的异常会在CompleteFuture中 | ||
* | ||
* @param data {@link Log} | ||
* @return {@link CompletableFuture<Response>} submit result | ||
* @return {@link CompletableFuture} submit result | ||
* @throws Exception when submit throw Exception | ||
*/ | ||
CompletableFuture<Response> submitAsync(Log data); | ||
|
||
/** | ||
* New member list | ||
* New member list . | ||
* 新的成员节点列表,一致性协议自行处理相应的成员节点是加入还是离开 | ||
* | ||
* @param addresses [ip:port, ip:port, ...] | ||
*/ | ||
void memberChange(Set<String> addresses); | ||
|
||
/** | ||
* Consistency agreement service shut down | ||
* Consistency agreement service shut down . | ||
* 一致性协议服务关闭 | ||
*/ | ||
void shutdown(); | ||
|
||
} |
Oops, something went wrong.