Skip to content

Commit

Permalink
add case sensitive feature and unpub/unsub event (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
straybirdzls authored Feb 14, 2020
1 parent f05811c commit 81a0b16
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,53 @@ public class ValueConstants {
/**
* The constant DEFAULT_GROUP.
*/
public static final String DEFAULT_GROUP = "DEFAULT_GROUP";
public static final String DEFAULT_GROUP = "DEFAULT_GROUP";

/**
* The constant DEFAULT_ZONE.
*/
public static final String DEFAULT_ZONE = "DEFAULT_ZONE";
public static final String DEFAULT_ZONE = "DEFAULT_ZONE";

public static final String DEFAULT_INSTANCE_ID = "DEFAULT_INSTANCE_ID";
public static final String DEFAULT_INSTANCE_ID = "DEFAULT_INSTANCE_ID";

/**
* The constant DEFAULT_DATA_CENTER.
*/
public static final String DEFAULT_DATA_CENTER = "DefaultDataCenter";
public static final String DEFAULT_DATA_CENTER = "DefaultDataCenter";

public static final long DEFAULT_NO_DATUM_VERSION = 1L;
public static final long DEFAULT_NO_DATUM_VERSION = 1L;

private static final Integer SYSTEM_RAFT_PORT = Integer
.getInteger("RAFT_SERVER_PORT");
private static final Integer SYSTEM_RAFT_PORT = Integer
.getInteger("RAFT_SERVER_PORT");

public static final int RAFT_SERVER_PORT = SYSTEM_RAFT_PORT != null ? SYSTEM_RAFT_PORT
: 9614;
public static final int RAFT_SERVER_PORT = SYSTEM_RAFT_PORT != null ? SYSTEM_RAFT_PORT
: 9614;

private static final String SYSTEM_RAFT_GROUP = System
.getProperty("RAFT_SERVER_GROUP");
private static final String SYSTEM_RAFT_GROUP = System
.getProperty("RAFT_SERVER_GROUP");

public static final String RAFT_SERVER_GROUP = SYSTEM_RAFT_GROUP != null ? SYSTEM_RAFT_GROUP
: "RegistryGroup";
public static final String RAFT_SERVER_GROUP = SYSTEM_RAFT_GROUP != null ? SYSTEM_RAFT_GROUP
: "RegistryGroup";

public static final String STOP_PUSH_DATA_SWITCH_DATA_ID = "session.stop.push.data.switch#@#9600#@#CONFIG";
public static final String STOP_PUSH_DATA_SWITCH_DATA_ID = "session.stop.push.data.switch#@#9600#@#CONFIG";

public static final String BLACK_LIST_DATA_ID = "session.blacklist.data#@#9600#@#CONFIG";
public static final String BLACK_LIST_DATA_ID = "session.blacklist.data#@#9600#@#CONFIG";

public static final String ENABLE_DATA_RENEW_SNAPSHOT = "session.enable.datum.renew.switch#@#9600#@#CONFIG";
public static final String ENABLE_DATA_RENEW_SNAPSHOT = "session.enable.datum.renew.switch#@#9600#@#CONFIG";

public static final String ENABLE_DATA_DATUM_EXPIRE = "data.enable.datum.expire.switch#@#9600#@#CONFIG";
public static final String ENABLE_DATA_DATUM_EXPIRE = "data.enable.datum.expire.switch#@#9600#@#CONFIG";

public static final String LOGGER_NAME_RENEW = "RENEW-LOGGER";
public static final String LOGGER_NAME_RENEW = "RENEW-LOGGER";

/**
* switch key for dataId sensitive is disable or not
*/
public static final String DISABLE_DATA_ID_CASE_SENSITIVE_SWITCH = "disable.dataId.case.sensitive";
/**
* switch for dataId sensitive is disable or not, default value is false which means dataId is case sensitive
*/
public static final Boolean DISABLE_DATA_ID_CASE_SENSITIVE = Boolean
.valueOf(System
.getProperty(DISABLE_DATA_ID_CASE_SENSITIVE_SWITCH));

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package com.alipay.sofa.registry.common.model.store;

import com.alipay.sofa.registry.common.model.constants.ValueConstants;

import java.io.Serializable;

/**
Expand Down Expand Up @@ -61,7 +63,11 @@ public static String toDataInfoId(String dataId, String instanceId, String dataT
if (dataId == null || dataId.isEmpty()) {
throw new IllegalArgumentException("error dataId:" + dataId);
}
buf.append(dataId);
if (ValueConstants.DISABLE_DATA_ID_CASE_SENSITIVE) {
buf.append(dataId.toUpperCase());
} else {
buf.append(dataId);
}

if (instanceId == null || instanceId.isEmpty()) {
throw new IllegalArgumentException("error instanceId:" + instanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public enum TaskType {
RECEIVED_DATA_CONFIG_PUSH_TASK("ReceivedDataConfigPushTask"), //
CANCEL_DATA_TASK("CancelDataTask"), //
SYNC_PUBLISHER_TASK("SyncPublisherTask"), //
SYNC_UNPUBLISHER_TASK("SyncUnPublisherTask"), //
SYNC_SUBSCRIBER_TASK("SyncSubscriberTask"), //
SYNC_UNSUBSCRIBER_TASK("SyncUnSubscriberTask"), //
SESSION_REGISTER_DATA_TASK("SessionRegisterDataTask"), //
PROVIDE_DATA_CHANGE_FETCH_TASK("ProvideDataChangeFetchTask"), //
SUBSCRIBER_MULTI_FETCH_TASK("SubscriberMultiFetchTask"), //
Expand Down

0 comments on commit 81a0b16

Please sign in to comment.