Skip to content

Commit

Permalink
support intelligent tiering
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Jan 22, 2025
1 parent 63ac56c commit 8bd59ef
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/qiniu/storage/model/FileInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public final class FileInfo {
* 2 表示归档存储
* 3 表示深度归档存储
* 4 表示归档直读存储
* 5 表示智能分层
*/
public int type;

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/qiniu/storage/model/StorageType.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public enum StorageType {
* 归档直读存储
*/
ArchiveIR,

/**
* 智能分层
*/
IntelligentTiering,
}
46 changes: 46 additions & 0 deletions src/test/java/test/com/qiniu/storage/BucketTest2.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,52 @@ public void testBuckets() {
}
}

@Test
@Tag("IntegrationTest")
public void testStorageTypeIntelligentTiering() {
String key = "storage_type_intelligent_tiering";
String bucket = TestConfig.testBucket_z0;

// 清理文件
try {
Response response = bucketManager.delete(bucket, key);
assertTrue(response.isOK(), "response is not OK");
} catch (QiniuException e) {
e.printStackTrace();
fail();
}

// 上传文件
try {
StringMap map = new StringMap();
map.put("insertOnly", "1");
uploadManager.put("aaa".getBytes(), key, TestConfig.testAuth.uploadToken(bucket), map, null, false);
} catch (QiniuException e) {
e.printStackTrace();
fail();
}

// 修改文件修类型
try {
Response resp = bucketManager.changeType(bucket, key, StorageType.IntelligentTiering);
assertTrue(resp.isOK(), "change type failed");
} catch (QiniuException e) {
e.printStackTrace();
fail();
}

// 验证文件类型
try {
FileInfo fi = bucketManager.stat(bucket, key);
assertNotNull(fi, "stat failed");
assertEquals(5, fi.type, "stat failed");
assertEquals(fi.type, StorageType.IntelligentTiering.ordinal(), "stat failed");
} catch (QiniuException e) {
e.printStackTrace();
fail();
}
}

/**
* 测试列举空间域名
*/
Expand Down

0 comments on commit 8bd59ef

Please sign in to comment.