Skip to content

Commit c4c2a87

Browse files
authored
Add archive ir (#407)
1 parent ca44028 commit c4c2a87

File tree

27 files changed

+82
-61
lines changed

27 files changed

+82
-61
lines changed

cmd/asyncfetch.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package cmd
22

33
import (
4+
"github.com/spf13/cobra"
5+
46
"github.com/qiniu/qshell/v2/docs"
57
"github.com/qiniu/qshell/v2/iqshell"
68
"github.com/qiniu/qshell/v2/iqshell/storage/object/operations"
7-
"github.com/spf13/cobra"
89
)
910

1011
func asyncFetchCmdBuilder(cfg *iqshell.Config) *cobra.Command {
@@ -32,7 +33,7 @@ func asyncFetchCmdBuilder(cfg *iqshell.Config) *cobra.Command {
3233
cmd.Flags().StringVarP(&info.CallbackBody, "callback-body", "b", "", "callback body")
3334
cmd.Flags().StringVarP(&info.CallbackHost, "callback-host", "T", "", "callback HOST")
3435

35-
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "storage type, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
36+
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "storage type, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage, 4:ARCHIVE_IR storage")
3637
cmd.Flags().IntVarP(&info.FileType, "storage-type", "g", 0, "storage type, same to --file-type")
3738
_ = cmd.Flags().MarkDeprecated("storage-type", "use --file-type instead") // 废弃 storage-type
3839

cmd/bucket.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package cmd
22

33
import (
4+
"github.com/spf13/cobra"
5+
46
"github.com/qiniu/qshell/v2/docs"
57
"github.com/qiniu/qshell/v2/iqshell"
68
"github.com/qiniu/qshell/v2/iqshell/common/data"
79
"github.com/qiniu/qshell/v2/iqshell/storage/bucket/operations"
8-
"github.com/spf13/cobra"
910
)
1011

1112
var domainsCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
@@ -136,7 +137,7 @@ var listBucketCmd2Builder = func(cfg *iqshell.Config) *cobra.Command {
136137
cmd.Flags().StringVarP(&info.StartDate, "start", "s", "", "start date with format yyyy-mm-dd-hh-MM-ss, all files will be listed according to the prefix and then filtered.")
137138
cmd.Flags().StringVarP(&info.EndDate, "end", "e", "", "end date with format yyyy-mm-dd-hh-MM-ss, all files will be listed according to the prefix and then filtered.")
138139

139-
cmd.Flags().StringVarP(&info.FileTypes, "file-types", "", "", "Specify storage type, separated by comma, all files will be listed according to the prefix and then filtered. 0:STANDARD storage, 1:IA storage, 2 means ARCHIVE storage. 3:DEEP_ARCHIVE storage")
140+
cmd.Flags().StringVarP(&info.FileTypes, "file-types", "", "", "Specify storage type, separated by comma, all files will be listed according to the prefix and then filtered. 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage 4:ARCHIVE_IR storage")
140141
cmd.Flags().StringVarP(&info.FileTypes, "storages", "", "", "Specify storage type, same to --file-types")
141142
_ = cmd.Flags().MarkDeprecated("storages", "use --file-types instead") // 废弃 storages
142143

cmd/rs.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package cmd
22

33
import (
4+
"github.com/spf13/cobra"
5+
46
"github.com/qiniu/qshell/v2/docs"
57
"github.com/qiniu/qshell/v2/iqshell"
68
"github.com/qiniu/qshell/v2/iqshell/storage/object/operations"
7-
"github.com/spf13/cobra"
89
)
910

1011
var statCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
@@ -88,8 +89,9 @@ var changeLifecycleCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
8889
},
8990
}
9091
cmd.Flags().IntVarP(&info.ToIAAfterDays, "to-ia-after-days", "", 0, "to IA storage after some days. the range is -1 or bigger than 0. -1 means cancel to IA storage")
91-
cmd.Flags().IntVarP(&info.ToArchiveAfterDays, "to-archive-after-days", "", 0, "to archive storage after some days. the range is -1 or bigger than 0. -1 means cancel to archive storage")
92-
cmd.Flags().IntVarP(&info.ToDeepArchiveAfterDays, "to-deep-archive-after-days", "", 0, "to deep archive storage after some days. the range is -1 or bigger than 0. -1 means cancel to deep archive storage")
92+
cmd.Flags().IntVarP(&info.ToArchiveIRAfterDays, "to-archive-ir-after-days", "", 0, "to ARCHIVE_IR storage after some days. the range is -1 or bigger than 0. -1 means cancel to ARCHIVE_IR storage")
93+
cmd.Flags().IntVarP(&info.ToArchiveAfterDays, "to-archive-after-days", "", 0, "to ARCHIVE storage after some days. the range is -1 or bigger than 0. -1 means cancel to ARCHIVE storage")
94+
cmd.Flags().IntVarP(&info.ToDeepArchiveAfterDays, "to-deep-archive-after-days", "", 0, "to DEEP_ARCHIVE storage after some days. the range is -1 or bigger than 0. -1 means cancel to DEEP_ARCHIVE storage")
9395
cmd.Flags().IntVarP(&info.DeleteAfterDays, "delete-after-days", "", 0, "delete after some days. the range is -1 or bigger than 0. -1 means cancel to delete")
9496
return cmd
9597
}
@@ -242,7 +244,8 @@ var changeTypeCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
242244
And 0 means STANDARD storage,
243245
while 1 means IA storage,
244246
while 2 means ARCHIVE storage.
245-
while 3 means DEEP_ARCHIVE storage.`,
247+
while 3 means DEEP_ARCHIVE storage.
248+
while 4 means ARCHIVE_IR storage.`,
246249
Example: `change storage type of A.png(bucket:bucketA key:A.png) to ARCHIVE storage
247250
qshell chtype bucketA A.png 2
248251
and you can check result by command:

cmd/rsbatch.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ Lifecycle value must great than or equal to -1, unit: day.
176176
},
177177
}
178178
cmd.Flags().IntVarP(&info.ToIAAfterDays, "to-ia-after-days", "", 0, "to IA storage after some days. the range is -1 or bigger than 0. -1 means cancel to IA storage")
179-
cmd.Flags().IntVarP(&info.ToArchiveAfterDays, "to-archive-after-days", "", 0, "to archive storage after some days. the range is -1 or bigger than 0. -1 means cancel to archive storage")
180-
cmd.Flags().IntVarP(&info.ToDeepArchiveAfterDays, "to-deep-archive-after-days", "", 0, "to deep archive storage after some days. the range is -1 or bigger than 0. -1 means cancel to deep archive storage")
179+
cmd.Flags().IntVarP(&info.ToArchiveIRAfterDays, "to-archive-ir-after-days", "", 0, "to ARCHIVE_IR storage after some days. the range is -1 or bigger than 0. -1 means cancel to ARCHIVE_IR storage")
180+
cmd.Flags().IntVarP(&info.ToArchiveAfterDays, "to-archive-after-days", "", 0, "to ARCHIVE storage after some days. the range is -1 or bigger than 0. -1 means cancel to ARCHIVE storage")
181+
cmd.Flags().IntVarP(&info.ToDeepArchiveAfterDays, "to-deep-archive-after-days", "", 0, "to DEEP_ARCHIVE storage after some days. the range is -1 or bigger than 0. -1 means cancel to DEEP_ARCHIVE storage")
181182
cmd.Flags().IntVarP(&info.DeleteAfterDays, "delete-after-days", "", 0, "delete after some days. the range is -1 or bigger than 0. -1 means cancel to delete")
182183
setBatchCmdDefaultFlags(cmd, &info.BatchInfo)
183184
return cmd

cmd/upload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var upload2CmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
9898
cmd.Flags().StringVar(&LogLevel, "log-level", "debug", "log level")
9999
cmd.Flags().IntVar(&LogRotate, "log-rotate", 7, "log rotate days")
100100

101-
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
101+
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage, 4:ARCHIVE_IR storage")
102102
cmd.Flags().IntVarP(&info.FileType, "storage", "", 0, "set storage type of file, same to --file-type")
103103
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage
104104

@@ -135,7 +135,7 @@ var syncCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
135135
cmd.Flags().Int64VarP(&info.ChunkSize, "resumable-api-v2-part-size", "", data.BLOCK_SIZE, "the part size when use resumable upload v2 APIs to upload, default 4M")
136136
cmd.Flags().StringVarP(&info.UpHost, "up-host", "u", "", "upload host")
137137

138-
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
138+
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage, 4:ARCHIVE_IR storage")
139139
cmd.Flags().IntVarP(&info.FileType, "storage", "s", 0, "set storage type of file, same to --file-type")
140140
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage
141141

@@ -169,7 +169,7 @@ var formUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
169169
cmd.Flags().BoolVarP(&info.Overwrite, "overwrite", "", false, "overwrite the file of same key in bucket")
170170
cmd.Flags().StringVarP(&info.MimeType, "mimetype", "t", "", "file mime type")
171171

172-
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
172+
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage, 4:ARCHIVE_IR storage")
173173
cmd.Flags().IntVarP(&info.FileType, "storage", "s", 0, "set storage type of file, same to --file-type")
174174
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage
175175

@@ -211,7 +211,7 @@ var resumeUploadCmdBuilder = func(cfg *iqshell.Config) *cobra.Command {
211211
cmd.Flags().Int64VarP(&info.ChunkSize, "v2-part-size", "", data.BLOCK_SIZE, "the part size when use resumable upload v2 APIs to upload, same to --resumable-api-v2-part-size")
212212
_ = cmd.Flags().MarkDeprecated("v2-part-size", "use --resumable-api-v2-part-size instead")
213213

214-
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage")
214+
cmd.Flags().IntVarP(&info.FileType, "file-type", "", 0, "set storage type of file, 0:STANDARD storage, 1:IA storage, 2:ARCHIVE storage, 3:DEEP_ARCHIVE storage, 4:ARCHIVE_IR storage")
215215
cmd.Flags().IntVarP(&info.FileType, "storage", "s", 0, "set storage type of file, same to --file-type")
216216
_ = cmd.Flags().MarkDeprecated("storage", "use --file-type instead") // 废弃 storage
217217

cmd_test/version_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
package cmd
44

55
import (
6-
"github.com/qiniu/qshell/v2/cmd_test/test"
76
"strings"
87
"testing"
8+
9+
"github.com/qiniu/qshell/v2/cmd_test/test"
910
)
1011

1112
func TestVersion(t *testing.T) {

docs/abfetch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ qshell abfetch --doc
3737
- -b/--callback-body:回调的 http Body。 【可选】
3838
- -T/--callback-host:回调时的 HOST 头。 【可选】
3939
- -a/--callback-url:回调的请求地址。 【可选】
40-
- --file-type:抓取的资源存储在七牛存储空间的类型,0:普通存储 1:低频存储 2:归档存储 3:深度归档, 默认为: 0。 【可选】
40+
- --file-type:抓取的资源存储在七牛存储空间的类型,0:普通存储 1:低频存储 2:归档存储 3:深度归档 4:归档直读存储, 默认为: 0。 【可选】
4141
- -c/--thread-count:指定抓取时使用的线程数目,默认:20。 【可选】
4242
- --overwrite:是否覆盖空间已有文件,默认为 `false`。 【可选】
4343
- -s/--success-list:指定一个文件的路径,如果资源抓取成功,则将资源信息写入此文件;默认不导出。 【可选】

docs/batchchlifecycle.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
* 大于 0: 设置相关的生命周期
1010
2. 生命周期时间大小规则如下(在相关生命周期时间值大于 0 时需满足):
1111
```
12-
转低频存储时间 < 转归档存储时间 < 转深度归档存储时间
12+
转低频存储时间 < 转归档直读存储时间 < 转归档存储时间 < 转深度归档存储时间
1313
```
14-
3. 转低频存储时间、转归档存储时间、转深度归档存储时间 和 过期删除时间 至少配置一个
14+
3. 转低频存储时间、转归档直读存储时间、转归档存储时间、转深度归档存储时间 和 过期删除时间 至少配置一个
1515

1616
# 格式
1717
```
18-
qshell batchchlifecycle [--force] [--success-list <SuccessFileName>] [--failure-list <FailureFileName>] [--sep <Separator>] [--worker <WorkerCount>] [--to-ia-after-days <ToIAAfterDays>] [--to-archive-after-days <ToArchiveAfterDays>] [--to-deep-archive-after-days <ToDeepArchiveAfterDays>] [--delete-after-days <DeleteAfterDays>] <Bucket> <-i KeysFile>
18+
qshell batchchlifecycle [--force] [--success-list <SuccessFileName>] [--failure-list <FailureFileName>] [--sep <Separator>] [--worker <WorkerCount>] [--to-ia-after-days <ToIAAfterDays>] [--to-archive-ir-after-days <ToArchiveAfterDays>] [--to-archive-after-days <ToArchiveAfterDays>] [--to-deep-archive-after-days <ToDeepArchiveAfterDays>] [--delete-after-days <DeleteAfterDays>] <Bucket> <-i KeysFile>
1919
```
2020

2121
# 帮助文档
@@ -44,9 +44,10 @@ $ qshell batchchlifecycle --doc
4444
<Key><Sep><Other> // <Key>:文件名,<Sep>:分割符,<Other> 其他无效内容
4545
```
4646
- --to-ia-after-days:指定文件上传后并在设置的时间后转换到 `低频存储类型`;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的转 `低频存储` 的生命周期规则,单位:天【可选】
47+
- --to-archive-ir-after-days:指定文件上传后并在设置的时间后转换到 `归档直读存储类型`;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的转 `归档直读存储` 的生命周期规则,单位:天【可选】
4748
- --to-archive-after-days:指定文件上传后并在设置的时间后转换到 `归档存储类型`;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的转 `归档存储` 的生命周期规则,单位:天【可选】
4849
- --to-deep-archive-after-days:指定文件上传后并在设置的时间后转换到 `深度归档存储类型`;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的转 `深度归档存储` 的生命周期规则,单位:天【可选】
49-
- --delete-after-days:指定文件上传后并在设置的时间后进行 `过期删除`,删除后不可恢复;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的 `过期删除` 的生命周期规则,单位:天【可选】
50+
- --delete-after-days:指定文件上传后并在设置的时间后进行 `过期删除`,删除后不可恢复;值范围为 -1 或者大于 0,设置为 -1 表示取消已设置的 `过期删除` 的生命周期规则,单位:天【可选】
5051
- -y/--force:该选项控制工具的默认行为。默认情况下,对于批量操作,工具会要求使用者输入一个验证码,确认下要进行批量文件操作了,避免操作失误的发生。如果不需要这个验证码的提示过程可以使用此选项。【可选】
5152
- -s/--success-list:该选项指定一个文件,程序会把操作成功的资源信息导入到该文件;默认不导出。【可选】
5253
- -e/--failure-list:该选项指定一个文件,程序会把操作失败的资源信息加上错误信息导入该文件;默认不导出。【可选】
@@ -58,7 +59,7 @@ $ qshell batchchlifecycle --doc
5859
- --record-redo-while-error:依赖于 --enable-record;命令重新执行时,命令中所有任务会从头到尾重新执行;每个任务执行前会根据记录先查看当前任务是否已经执行,如果任务已执行且失败,则再执行一次;默认为 false,当任务执行失败则跳过不再重新执行。 【可选】
5960

6061
# 示例
61-
1 比如我们要将空间 `if-pbl` 里面一些文件的生命周期改为 30 天后转低频存储,60 天后转归档存储,180 天后转深度归档存储,365 天后过期删除;我们可以指定如下的 `KeysFile` 的内容:
62+
1 比如我们要将空间 `if-pbl` 里面一些文件的生命周期改为 30 天后转低频存储,60 天后转归档直读存储,120 天后转归档存储,180 天后转深度归档存储,365 天后过期删除;我们可以指定如下的 `KeysFile` 的内容:
6263
```
6364
2015/03/22/qiniu.png
6465
2015/photo.jpg
@@ -68,7 +69,8 @@ $ qshell batchchlifecycle --doc
6869
```
6970
$ qshell batchchlifecycle if-pbl -i lifecycle.txt \
7071
--to-ia-after-days 30 \
71-
--to-archive-after-days 60 \
72+
--to-archive-ir-after-days 60 \
73+
--to-archive-after-days 120 \
7274
--to-deep-archive-after-days 180 \
7375
--delete-after-days 365
7476
```

docs/batchchtype.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 简介
2-
`batchchtype` 命令用来为空间中的文件设置存储类型。该操作发生在同一个空间中。(将文件设置为 **深度归档存储** 或者 **归档存储** 或者 **低频存储** 或者 **普通存储**,默认:文件为 **普通存储**
2+
`batchchtype` 命令用来为空间中的文件设置存储类型。该操作发生在同一个空间中。(将文件设置为 **深度归档存储** 或者 **归档存储** 或者 **归档直读存储** 或者 **低频存储** 或者 **普通存储**,默认:文件为 **普通存储**
33

44
# 格式
55
```
@@ -23,7 +23,7 @@ $ qshell batchchtype --doc
2323
- Bucket:空间名,可以为公开空间或私有空间。【必选】
2424

2525
# 选项
26-
- -i/--input-file:接受一个文件, 文件内容每行包含 `原文件名``存储类型`,存储类型用数字表示,0 为普通存储,1 为低频存储,2 为归档存储,3 为深度归档存储。每行多个元素名之间用分割符分隔(默认 tab 制表符); 如果需要自定义分割符,可以使用 `-F``--sep` 选项指定自定义的分隔符。如果没有通过该选项指定该文件参数, 从标准输入读取内容。每行包含 `文件名``存储类型`;具体格式如下:(【可选】)
26+
- -i/--input-file:接受一个文件, 文件内容每行包含 `原文件名``存储类型`,存储类型用数字表示,0 为普通存储,1 为低频存储,2 为归档存储,3 为深度归档存储,4 为归档直读存储。每行多个元素名之间用分割符分隔(默认 tab 制表符); 如果需要自定义分割符,可以使用 `-F``--sep` 选项指定自定义的分隔符。如果没有通过该选项指定该文件参数, 从标准输入读取内容。每行包含 `文件名``存储类型`;具体格式如下:(【可选】)
2727
```
2828
<Key><Sep>1 // <Key>:文件名,<Sep>:分割符,1:低频存储。
2929
```

0 commit comments

Comments
 (0)