接口 ConsistencyService
-
- 所有已知子接口:
PersistentConsistencyService
- 所有已知实现类:
BasePersistentServiceProcessor,PersistentConsistencyServiceDelegateImpl,PersistentServiceProcessor,StandalonePersistentServiceProcessor
public interface ConsistencyServiceConsistence service for all implementations to derive.We announce this consistency service to decouple the specific consistency implementation with business logic. User should not be aware of what consistency protocol is being used.
In this way, we also provide space for user to extend the underlying consistency protocols, as long as they obey our consistency baseline.
- 从以下版本开始:
- 1.0.0
- 作者:
- nkorange
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 Datumget(java.lang.String key)Get a data from Nacos cluster.java.util.Optional<java.lang.String>getErrorMsg()Get the error message of the consistency protocol.booleanisAvailable()Tell the status of this consistency service.voidlisten(java.lang.String key, RecordListener listener)Listen for changes of a data.voidput(java.lang.String key, Record value)Put a data related to a key to Nacos cluster.voidremove(java.lang.String key)Remove a data from Nacos cluster.voidunListen(java.lang.String key, RecordListener listener)Cancel listening of a data.
-
-
-
方法详细资料
-
put
void put(java.lang.String key, Record value) throws com.alibaba.nacos.api.exception.NacosExceptionPut a data related to a key to Nacos cluster.- 参数:
key- key of data, this key should be globally uniquevalue- value of data- 抛出:
com.alibaba.nacos.api.exception.NacosException- nacos exception
-
remove
void remove(java.lang.String key) throws com.alibaba.nacos.api.exception.NacosExceptionRemove a data from Nacos cluster.- 参数:
key- key of data- 抛出:
com.alibaba.nacos.api.exception.NacosException- nacos exception
-
get
Datum get(java.lang.String key) throws com.alibaba.nacos.api.exception.NacosException
Get a data from Nacos cluster.- 参数:
key- key of data- 返回:
- data related to the key
- 抛出:
com.alibaba.nacos.api.exception.NacosException- nacos exception
-
listen
void listen(java.lang.String key, RecordListener listener) throws com.alibaba.nacos.api.exception.NacosExceptionListen for changes of a data.- 参数:
key- key of datalistener- callback of data change- 抛出:
com.alibaba.nacos.api.exception.NacosException- nacos exception
-
unListen
void unListen(java.lang.String key, RecordListener listener) throws com.alibaba.nacos.api.exception.NacosExceptionCancel listening of a data.- 参数:
key- key of datalistener- callback of data change- 抛出:
com.alibaba.nacos.api.exception.NacosException- nacos exception
-
getErrorMsg
java.util.Optional<java.lang.String> getErrorMsg()
Get the error message of the consistency protocol.- 返回:
- the consistency protocol error message.
-
isAvailable
boolean isAvailable()
Tell the status of this consistency service.- 返回:
- true if available
-
-