use of com.alibaba.nacos.config.server.model.event.ConfigDumpEvent in project nacos by alibaba.
the class EmbeddedStorageContextUtils method onDeleteConfigBetaInfo.
/**
* In the case of the in-cluster storage mode, the logic of horizontal notification is implemented asynchronously
* via the raft state machine, along with the information.
*
* @param namespaceId namespaceId
* @param group group
* @param dataId dataId
* @param time Operating time
*/
public static void onDeleteConfigBetaInfo(String namespaceId, String group, String dataId, long time) {
if (!EnvUtil.getStandaloneMode()) {
ConfigDumpEvent event = ConfigDumpEvent.builder().remove(true).namespaceId(namespaceId).dataId(dataId).group(group).isBeta(true).build();
Map<String, String> extendInfo = new HashMap<>(2);
extendInfo.put(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT, JacksonUtils.toJson(event));
EmbeddedStorageContextUtils.putAllExtendInfo(extendInfo);
}
}
use of com.alibaba.nacos.config.server.model.event.ConfigDumpEvent in project nacos by alibaba.
the class EmbeddedStorageContextUtils method onModifyConfigBetaInfo.
/**
* In the case of the in-cluster storage mode, the logic of horizontal notification is implemented asynchronously
* via the raft state machine, along with the information.
*
* @param configInfo {@link ConfigInfo}
* @param betaIps Receive client IP for grayscale configuration publishing
* @param srcIp The IP of the operator
* @param time Operating time
*/
public static void onModifyConfigBetaInfo(ConfigInfo configInfo, String betaIps, String srcIp, Timestamp time) {
if (!EnvUtil.getStandaloneMode()) {
ConfigDumpEvent event = ConfigDumpEvent.builder().remove(false).namespaceId(configInfo.getTenant()).dataId(configInfo.getDataId()).group(configInfo.getGroup()).isBeta(true).betaIps(betaIps).content(configInfo.getContent()).type(configInfo.getType()).handleIp(srcIp).lastModifiedTs(time.getTime()).encryptedDataKey(configInfo.getEncryptedDataKey()).build();
Map<String, String> extendInfo = new HashMap<>(2);
extendInfo.put(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT, JacksonUtils.toJson(event));
EmbeddedStorageContextUtils.putAllExtendInfo(extendInfo);
}
}
use of com.alibaba.nacos.config.server.model.event.ConfigDumpEvent in project nacos by alibaba.
the class EmbeddedStorageContextUtils method onModifyConfigInfo.
/**
* In the case of the in-cluster storage mode, the logic of horizontal notification is implemented asynchronously
* via the raft state machine, along with the information.
*
* @param configInfo {@link ConfigInfo}
* @param srcIp The IP of the operator
* @param time Operating time
*/
public static void onModifyConfigInfo(ConfigInfo configInfo, String srcIp, Timestamp time) {
if (!EnvUtil.getStandaloneMode()) {
ConfigDumpEvent event = ConfigDumpEvent.builder().remove(false).namespaceId(configInfo.getTenant()).dataId(configInfo.getDataId()).group(configInfo.getGroup()).isBeta(false).content(configInfo.getContent()).type(configInfo.getType()).handleIp(srcIp).lastModifiedTs(time.getTime()).encryptedDataKey(configInfo.getEncryptedDataKey()).build();
Map<String, String> extendInfo = new HashMap<>(2);
extendInfo.put(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT, JacksonUtils.toJson(event));
EmbeddedStorageContextUtils.putAllExtendInfo(extendInfo);
}
}
use of com.alibaba.nacos.config.server.model.event.ConfigDumpEvent in project nacos by alibaba.
the class EmbeddedStorageContextUtils method onBatchDeleteConfigInfo.
/**
* In the case of the in-cluster storage mode, the logic of horizontal notification is implemented asynchronously
* via the raft state machine, along with the information.
*
* @param configInfos {@link ConfigInfo} list
*/
public static void onBatchDeleteConfigInfo(List<ConfigInfo> configInfos) {
if (!EnvUtil.getStandaloneMode()) {
List<ConfigDumpEvent> events = new ArrayList<>();
for (ConfigInfo configInfo : configInfos) {
String namespaceId = StringUtils.isBlank(configInfo.getTenant()) ? StringUtils.EMPTY : configInfo.getTenant();
ConfigDumpEvent event = ConfigDumpEvent.builder().remove(true).namespaceId(namespaceId).group(configInfo.getGroup()).dataId(configInfo.getDataId()).isBeta(false).build();
events.add(event);
}
Map<String, String> extendInfo = new HashMap<>(2);
extendInfo.put(Constants.EXTEND_INFOS_CONFIG_DUMP_EVENT, JacksonUtils.toJson(events));
EmbeddedStorageContextUtils.putAllExtendInfo(extendInfo);
}
}
use of com.alibaba.nacos.config.server.model.event.ConfigDumpEvent in project nacos by alibaba.
the class EmbeddedStorageContextUtils method onDeleteConfigInfo.
/**
* In the case of the in-cluster storage mode, the logic of horizontal notification is implemented asynchronously
* via the raft state machine, along with the information.
*
* @param namespaceId namespaceId
* @param group groupName
* @param dataId dataId
* @param srcIp The IP of the operator
* @param time Operating time
*/
public static void onDeleteConfigInfo(String namespaceId, String group, String dataId, String srcIp, Timestamp time) {
if (!EnvUtil.getStandaloneMode()) {
ConfigDumpEvent event = ConfigDumpEvent.builder().remove(true).namespaceId(namespaceId).group(group).dataId(dataId).isBeta(false).handleIp(srcIp).lastModifiedTs(time.getTime()).build();
Map<String, String> extendInfo = new HashMap<>(2);
extendInfo.put(Constants.EXTEND_INFO_CONFIG_DUMP_EVENT, JacksonUtils.toJson(event));
EmbeddedStorageContextUtils.putAllExtendInfo(extendInfo);
}
}
Aggregations