mirror of
https://github.com/rclone/rclone
synced 2025-01-17 22:27:30 +01:00
Swift: Add storage_policy
This commit is contained in:
parent
f7c0b2407d
commit
578f56bba7
@ -120,6 +120,20 @@ func init() {
|
|||||||
Help: "Admin",
|
Help: "Admin",
|
||||||
Value: "admin",
|
Value: "admin",
|
||||||
}},
|
}},
|
||||||
|
}, {
|
||||||
|
Name: "storage_policy",
|
||||||
|
Help: "The storage policy to use when creating a new container",
|
||||||
|
Default: "",
|
||||||
|
Examples: []fs.OptionExample{{
|
||||||
|
Help: "Default",
|
||||||
|
Value: "",
|
||||||
|
}, {
|
||||||
|
Help: "OVH Public Cloud Storage",
|
||||||
|
Value: "pcs",
|
||||||
|
}, {
|
||||||
|
Help: "OVH Public Cloud Archive",
|
||||||
|
Value: "pca",
|
||||||
|
}},
|
||||||
}, {
|
}, {
|
||||||
Name: "chunk_size",
|
Name: "chunk_size",
|
||||||
Help: "Above this size files will be chunked into a _segments container.",
|
Help: "Above this size files will be chunked into a _segments container.",
|
||||||
@ -144,6 +158,7 @@ type Options struct {
|
|||||||
StorageURL string `config:"storage_url"`
|
StorageURL string `config:"storage_url"`
|
||||||
AuthToken string `config:"auth_token"`
|
AuthToken string `config:"auth_token"`
|
||||||
AuthVersion int `config:"auth_version"`
|
AuthVersion int `config:"auth_version"`
|
||||||
|
StoragePolicy string `config:"storage_policy"`
|
||||||
EndpointType string `config:"endpoint_type"`
|
EndpointType string `config:"endpoint_type"`
|
||||||
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
||||||
}
|
}
|
||||||
@ -583,7 +598,11 @@ func (f *Fs) Mkdir(dir string) error {
|
|||||||
_, _, err = f.c.Container(f.container)
|
_, _, err = f.c.Container(f.container)
|
||||||
}
|
}
|
||||||
if err == swift.ContainerNotFound {
|
if err == swift.ContainerNotFound {
|
||||||
err = f.c.ContainerCreate(f.container, nil)
|
headers := swift.Headers{}
|
||||||
|
if f.opt.StoragePolicy != "" {
|
||||||
|
headers["X-Storage-Policy"] = f.opt.StoragePolicy
|
||||||
|
}
|
||||||
|
err = f.c.ContainerCreate(f.container, headers)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
f.containerOK = true
|
f.containerOK = true
|
||||||
@ -880,7 +899,11 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
|||||||
var err error
|
var err error
|
||||||
_, _, err = o.fs.c.Container(o.fs.segmentsContainer)
|
_, _, err = o.fs.c.Container(o.fs.segmentsContainer)
|
||||||
if err == swift.ContainerNotFound {
|
if err == swift.ContainerNotFound {
|
||||||
err = o.fs.c.ContainerCreate(o.fs.segmentsContainer, nil)
|
headers := swift.Headers{}
|
||||||
|
if o.fs.opt.StoragePolicy != "" {
|
||||||
|
headers["X-Storage-Policy"] = o.fs.opt.StoragePolicy
|
||||||
|
}
|
||||||
|
err = o.fs.c.ContainerCreate(o.fs.segmentsContainer, headers)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -266,6 +266,11 @@ files whose local modtime is newer than the time it was last uploaded.
|
|||||||
Here are the command line options specific to this cloud storage
|
Here are the command line options specific to this cloud storage
|
||||||
system.
|
system.
|
||||||
|
|
||||||
|
#### --swift-storage-policy=STRING ####
|
||||||
|
Apply the specified storage policy when creating a new container. The policy
|
||||||
|
cannot be changed afterwards. The allowed configuration values and their
|
||||||
|
meaning depend on your Swift storage provider.
|
||||||
|
|
||||||
#### --swift-chunk-size=SIZE ####
|
#### --swift-chunk-size=SIZE ####
|
||||||
|
|
||||||
Above this size files will be chunked into a _segments container. The
|
Above this size files will be chunked into a _segments container. The
|
||||||
|
Loading…
Reference in New Issue
Block a user