diff --git a/src/Qiniu/Storage/BatchInfo.cs b/src/Qiniu/Storage/BatchInfo.cs
index 22a7316..33b1366 100644
--- a/src/Qiniu/Storage/BatchInfo.cs
+++ b/src/Qiniu/Storage/BatchInfo.cs
@@ -60,6 +60,7 @@ public class BatchData
/// 1 低频存储
/// 2 归档存储
/// 3 深度归档存储
+ /// 4 归档直读存储
///
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
public int FileType { get; set; }
@@ -99,24 +100,32 @@ public class BatchData
///
/// 文件生命周期中转为低频存储的日期,Unix 时间戳格式。
- /// 文件在设置过期时间后才会返回该字段。
- /// 历史文件过期仍会自动删除,但不会返回该字段,重新设置文件过期时间可使历史文件返回该字段。
+ /// 文件在设置低频存储转换时间后才会返回该字段。
+ /// 历史文件到期仍会自动转换,但不会返回该字段,重新设置文件转换时间可使历史文件返回该字段。
///
[JsonProperty("TransitionToIA", NullValueHandling = NullValueHandling.Ignore)]
public int TransitionToIa { get; set; }
+ ///
+ /// 文件生命周期中转为归档直读存储的日期,Unix 时间戳格式。
+ /// 文件在设置归档直读存储转换时间后才会返回该字段。
+ /// 历史文件到期仍会自动转换,但不会返回该字段,重新设置文件转换时间可使历史文件返回该字段。
+ ///
+ [JsonProperty("transitionToArchiveIR", NullValueHandling = NullValueHandling.Ignore)]
+ public int TransitionToArchiveIr { get; set; }
+
///
/// 文件生命周期中转为归档存储的日期,Unix 时间戳格式。
- /// 文件在设置过期时间后才会返回该字段。
- /// 历史文件过期仍会自动删除,但不会返回该字段,重新设置文件过期时间可使历史文件返回该字段。
+ /// 文件在设置归档存储转换时间后才会返回该字段。
+ /// 历史文件到期仍会自动转换,但不会返回该字段,重新设置文件转换时间可使历史文件返回该字段。
///
[JsonProperty("transitionToARCHIVE", NullValueHandling = NullValueHandling.Ignore)]
public int TransitionToArchive { get; set; }
///
/// 文件生命周期中转为深度归档存储的日期,Unix 时间戳格式。
- /// 文件在设置过期时间后才会返回该字段。
- /// 历史文件过期仍会自动删除,但不会返回该字段,重新设置文件过期时间可使历史文件返回该字段。
+ /// 文件在设置深度归档存储转换时间后才会返回该字段。
+ /// 历史文件到期仍会自动转换,但不会返回该字段,重新设置文件转换时间可使历史文件返回该字段。
///
[JsonProperty("transitionToDeepArchive", NullValueHandling = NullValueHandling.Ignore)]
public int TransitionToDeepArchive { get; set; }
diff --git a/src/Qiniu/Storage/BucketManager.cs b/src/Qiniu/Storage/BucketManager.cs
index 36aebed..7635df5 100644
--- a/src/Qiniu/Storage/BucketManager.cs
+++ b/src/Qiniu/Storage/BucketManager.cs
@@ -338,7 +338,14 @@ public HttpResult ChangeStatus(string bucket, string key, int status)
///
/// 空间名称
/// 文件key
- /// 修改后的文件存储类型,0表示普通存储,1表示低频存储,2表示归档存储,3表示深度归档存储
+ ///
+ /// 修改后的文件存储类型:
+ /// 0 表示普通存储;
+ /// 1 表示低频存储;
+ /// 2 表示归档存储;
+ /// 3 表示深度归档存储;
+ /// 4 表示归档直读存储;
+ ///
/// 状态码为200时表示OK
public HttpResult ChangeType(string bucket, string key, int fileType)
{
@@ -414,11 +421,32 @@ private BatchResult Batch(string batchOps)
{
BatchResult result = new BatchResult();
+ string bucket = "";
+ foreach (string op in batchOps.Split('&'))
+ {
+ string[] segments = op.Split('/');
+ if (segments.Length > 3)
+ {
+ string entry = Encoding.UTF8.GetString(Base64.UrlsafeBase64Decode(segments[2]));
+ bucket = entry.Split(':')[0];
+ }
+
+ if (bucket.Length > 0)
+ {
+ break;
+ }
+ }
+
+ if (bucket.Length == 0)
+ {
+ result.RefCode = (int)HttpCode.INVALID_ARGUMENT;
+ result.RefText = "bucket is Empty";
+ return result;
+ }
+
try
{
- string scheme = this.config.UseHttps ? "https://" : "http://";
- string rsHost = string.Format("{0}{1}", scheme, Config.DefaultRsHost);
- string batchUrl = rsHost + "/batch";
+ string batchUrl = string.Format("{0}/batch", this.config.RsHost(this.mac.AccessKey, bucket));
HttpResult hr = httpManager.PostForm(batchUrl, null, batchOps, auth);
result.Shadow(hr);
@@ -707,7 +735,8 @@ public HttpResult SetObjectLifecycle(
int toIaAfterDays = 0,
int toArchiveAfterDays = 0,
int toDeepArchiveAfterDays = 0,
- int deleteAfterDays = 0
+ int deleteAfterDays = 0,
+ int toArchiveIrAfterDays = 0
)
{
return SetObjectLifecycle(
@@ -717,7 +746,8 @@ public HttpResult SetObjectLifecycle(
toIaAfterDays,
toArchiveAfterDays,
toDeepArchiveAfterDays,
- deleteAfterDays
+ deleteAfterDays,
+ toArchiveIrAfterDays
);
}
@@ -728,6 +758,7 @@ public HttpResult SetObjectLifecycle(
/// 文件key
/// 匹配条件,只有条件匹配才会设置成功,目前支持:hash、mime、fsize、putTime
/// 多少天后将文件转为低频存储,设置为 -1 表示取消已设置的转低频存储的生命周期规则,0 表示不修改转低频生命周期规则。
+ /// 多少天后将文件转为归档直读存储,设置为 -1 表示取消已设置的转归档直读存储的生命周期规则,0 表示不修改转归档直读生命周期规则。
/// 多少天后将文件转为归档存储,设置为 -1 表示取消已设置的转归档存储的生命周期规则,0 表示不修改转归档生命周期规则。
/// 多少天后将文件转为深度归档存储,设置为 -1 表示取消已设置的转深度归档存储的生命周期规则,0 表示不修改转深度归档生命周期规则。
/// 多少天后将文件删除,设置为 -1 表示取消已设置的删除存储的生命周期规则,0 表示不修改删除存储的生命周期规则。
@@ -739,7 +770,8 @@ public HttpResult SetObjectLifecycle(
int toIaAfterDays = 0,
int toArchiveAfterDays = 0,
int toDeepArchiveAfterDays = 0,
- int deleteAfterDays = 0
+ int deleteAfterDays = 0,
+ int toArchiveIrAfterDays = 0
)
{
HttpResult result = new HttpResult();
@@ -747,7 +779,7 @@ public HttpResult SetObjectLifecycle(
try
{
string updateUrl = string.Format("{0}{1}", this.config.RsHost(this.mac.AccessKey, bucket),
- SetObjectLifecycleOp(bucket, key, cond, toIaAfterDays, toArchiveAfterDays, toDeepArchiveAfterDays, deleteAfterDays));
+ SetObjectLifecycleOp(bucket, key, cond, toIaAfterDays, toArchiveAfterDays, toDeepArchiveAfterDays, deleteAfterDays, toArchiveIrAfterDays));
StringDictionary headers = new StringDictionary
{
{"Content-Type", ContentType.WWW_FORM_URLENC}
@@ -954,6 +986,7 @@ public string DeleteAfterDaysOp(string bucket, string key, int deleteAfterDays)
/// 文件key
/// 匹配条件,只有条件匹配才会设置成功,目前支持:hash、mime、fsize、putTime
/// 多少天后将文件转为低频存储,设置为 -1 表示取消已设置的转低频存储的生命周期规则,0 表示不修改转低频生命周期规则。
+ /// 多少天后将文件转为归档直读存储,设置为 -1 表示取消已设置的转归档直读存储的生命周期规则,0 表示不修改转归档直读生命周期规则。
/// 多少天后将文件转为归档存储,设置为 -1 表示取消已设置的转归档存储的生命周期规则,0 表示不修改转归档生命周期规则。
/// 多少天后将文件转为深度归档存储,设置为 -1 表示取消已设置的转深度归档存储的生命周期规则,0 表示不修改转深度归档生命周期规则。
/// 多少天后将文件删除,设置为 -1 表示取消已设置的删除存储的生命周期规则,0 表示不修改删除存储的生命周期规则。
@@ -965,13 +998,14 @@ public string SetObjectLifecycleOp(
int toIaAfterDays = 0,
int toArchiveAfterDays = 0,
int toDeepArchiveAfterDays = 0,
- int deleteAfterDays = 0
+ int deleteAfterDays = 0,
+ int toArchiveIrAfterDays = 0
)
{
string entry = Base64.UrlSafeBase64Encode(bucket, key);
string result = string.Format(
- "/lifecycle/{0}/toIAAfterDays/{1}/toArchiveAfterDays/{2}/toDeepArchiveAfterDays/{3}/deleteAfterDays/{4}",
- entry, toIaAfterDays, toArchiveAfterDays, toDeepArchiveAfterDays, deleteAfterDays);
+ "/lifecycle/{0}/toIAAfterDays/{1}/toArchiveIRAfterDays/{2}/toArchiveAfterDays/{3}/toDeepArchiveAfterDays/{4}/deleteAfterDays/{5}",
+ entry, toIaAfterDays, toArchiveIrAfterDays, toArchiveAfterDays, toDeepArchiveAfterDays, deleteAfterDays);
if (cond != null)
{
@@ -980,7 +1014,6 @@ public string SetObjectLifecycleOp(
result += "/cond/" + Base64.UrlSafeBase64Encode(query);
}
- Console.WriteLine(result);
return result;
}
diff --git a/src/Qiniu/Storage/FileInfo.cs b/src/Qiniu/Storage/FileInfo.cs
index 4a75d22..ac54d79 100644
--- a/src/Qiniu/Storage/FileInfo.cs
+++ b/src/Qiniu/Storage/FileInfo.cs
@@ -37,6 +37,7 @@ public class FileInfo
/// 1 低频存储
/// 2 归档存储
/// 3 深度归档存储
+ /// 4 归档直读存储
///
[JsonProperty("type")]
public int FileType { get; set; }
@@ -79,9 +80,17 @@ public class FileInfo
/// 文件在设置过期时间后才会返回该字段。
/// 历史文件过期仍会自动删除,但不会返回该字段,重新设置文件过期时间可使历史文件返回该字段。
///
- [JsonProperty("TransitionToIA", NullValueHandling = NullValueHandling.Ignore)]
+ [JsonProperty("transitionToIA", NullValueHandling = NullValueHandling.Ignore)]
public int TransitionToIa { get; set; }
+ ///
+ /// 文件生命周期中转为归档直读存储的日期,Unix 时间戳格式。
+ /// 文件在设置过期时间后才会返回该字段。
+ /// 历史文件过期仍会自动删除,但不会返回该字段,重新设置文件过期时间可使历史文件返回该字段。
+ ///
+ [JsonProperty("transitionToArchiveIR", NullValueHandling = NullValueHandling.Ignore)]
+ public int TransitionToArchiveIr { get; set; }
+
///
/// 文件生命周期中转为归档存储的日期,Unix 时间戳格式。
/// 文件在设置过期时间后才会返回该字段。
diff --git a/src/Qiniu/Storage/ListItem.cs b/src/Qiniu/Storage/ListItem.cs
index b3b6f24..16f8471 100644
--- a/src/Qiniu/Storage/ListItem.cs
+++ b/src/Qiniu/Storage/ListItem.cs
@@ -42,6 +42,7 @@ public class ListItem
/// 1 低频存储
/// 2 归档存储
/// 3 深度归档存储
+ /// 4 归档直读存储
///
[JsonProperty("type")]
public int FileType { get; set; }
diff --git a/src/QiniuTests/Storage/BucketManagerTests.cs b/src/QiniuTests/Storage/BucketManagerTests.cs
index 7677ffd..0e06367 100644
--- a/src/QiniuTests/Storage/BucketManagerTests.cs
+++ b/src/QiniuTests/Storage/BucketManagerTests.cs
@@ -268,6 +268,8 @@ public void SetObjectLifecycleTest()
20,
30,
40);
+ // 40,
+ // 15);
if (ret.Code != (int)HttpCode.OK)
{
Assert.Fail("deleteAfterDays error: " + ret.ToString());
@@ -279,6 +281,7 @@ public void SetObjectLifecycleTest()
Assert.Fail("stat error: " + statRet.ToString());
}
Assert.True(statRet.Result.TransitionToIa > 0);
+ // Assert.True(statRet.Result.TransitionToArchiveIr > 0);
Assert.True(statRet.Result.TransitionToArchive > 0);
Assert.True(statRet.Result.TransitionToDeepArchive > 0);
Assert.True(statRet.Result.Expiration > 0);
@@ -319,6 +322,8 @@ public void SetObjectLifecycleCondTest()
20,
30,
40);
+ // 40,
+ // 15);
if (ret.Code != (int)HttpCode.OK)
{
Assert.Fail("deleteAfterDays error: " + ret.ToString());