Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ap-northeast-1 #485

Merged
merged 11 commits into from
Oct 21, 2022
36 changes: 20 additions & 16 deletions library/src/main/java/com/qiniu/android/common/FixedZone.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public final class FixedZone extends Zone {
new String[]{"upload.qbox.me", "up.qbox.me"},
"z0");

/**
* 华东浙江 2 机房
*/
public static final Zone zoneCnEast2 = new FixedZone(new String[]{"upload-cn-east-2.qiniup.com", "up-cn-east-2.qiniup.com"},
null,
"cn-east-2");

/**
* 华北机房
*/
Expand All @@ -33,6 +40,13 @@ public final class FixedZone extends Zone {
new String[]{"upload-z2.qbox.me", "up-z2.qbox.me"},
"z2");

/**
* 首尔机房
*/
public static final Zone zoneNorthEast1 = new FixedZone(new String[]{"upload-ap-northeast-1.qiniup.com", "up-ap-northeast-1.qiniup.com"},
null,
"ap-northeast-1");

/**
* 北美机房
*/
Expand All @@ -47,29 +61,16 @@ public final class FixedZone extends Zone {
new String[]{"upload-as0.qbox.me", "up-as0.qbox.me"},
"as0");

/**
* zone fog-cn-east-1 雾存储 华东-1
* 分片上传暂时仅支持分片 api v2
* 分片 api v2设置方式:配置 Configuration 的 resumeUploadVersion 为 Configuration.RESUME_UPLOAD_VERSION_V2
* eg:
* Configuration configuration = new Configuration.Builder()
* .resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V2)
* .build();
*
* @return 实例
*/
public static final Zone zoneFogCnEast1 = new FixedZone(new String[]{"upload-fog-cn-east-1.qiniup.com", "up-fog-cn-east-1.qiniup.com"},
new String[]{"upload-fog-cn-east-1.qiniup.com", "up-fog-cn-east-1.qiniup.com"},
"fog-cn-east-1");

private ZonesInfo zonesInfo;

public static FixedZone localsZoneInfo() {
ArrayList<FixedZone> localsZone = new ArrayList<>();
localsZone.add((FixedZone)zone0);
localsZone.add((FixedZone)zoneCnEast2);
localsZone.add((FixedZone)zone1);
localsZone.add((FixedZone)zone2);
localsZone.add((FixedZone)zoneNa0);
localsZone.add((FixedZone)zoneNorthEast1);
localsZone.add((FixedZone)zoneAs0);

ArrayList<ZoneInfo> zoneInfoArray = new ArrayList<>();
Expand Down Expand Up @@ -115,9 +116,12 @@ private ZonesInfo createZonesInfo(String[] upDomains,

List<String> upDomainsList = new ArrayList<String>(Arrays.asList(upDomains));
List<String> oldUpDomainsList = null;
if (oldUpDomains != null){
if (oldUpDomains != null && oldUpDomains.length > 0){
oldUpDomainsList = new ArrayList<String>(Arrays.asList(oldUpDomains));
} else {
oldUpDomainsList = new ArrayList<>();
}

ZoneInfo zoneInfo = ZoneInfo.buildInfo(upDomainsList, oldUpDomainsList, regionId);
if (zoneInfo == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/
public interface KeyGenerator {
/**
* 根据服务器的key和本地文件名生成持久化纪录的key
* 根据服务器的 key 和本地文件名生成持久化纪录的 key
*
* @param key 服务器的key
* @param key 服务器的 key
* @param file 本地文件名
* @return 持久化上传纪录的key
* @return 持久化上传纪录的 key
*/
@Deprecated
String gen(String key, File file);
Expand Down