SetModTime sets the modification time of the local fs object
(ctx context.Context, modTime time.Time)
| 4132 | |
| 4133 | // SetModTime sets the modification time of the local fs object |
| 4134 | func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error { |
| 4135 | if o.fs.opt.Provider == "Rabata" { |
| 4136 | // Rabata does not support copying objects |
| 4137 | return fs.ErrorCantSetModTime |
| 4138 | } |
| 4139 | err := o.readMetaData(ctx) |
| 4140 | if err != nil { |
| 4141 | return err |
| 4142 | } |
| 4143 | o.meta[metaMtime] = swift.TimeToFloatString(modTime) |
| 4144 | |
| 4145 | // Can't update metadata here, so return this error to force a recopy |
| 4146 | if o.storageClass != nil && (*o.storageClass == "GLACIER" || *o.storageClass == "DEEP_ARCHIVE") { |
| 4147 | return fs.ErrorCantSetModTime |
| 4148 | } |
| 4149 | |
| 4150 | // Copy the object to itself to update the metadata |
| 4151 | bucket, bucketPath := o.split() |
| 4152 | req := s3.CopyObjectInput{ |
| 4153 | ContentType: aws.String(fs.MimeType(ctx, o)), // Guess the content type |
| 4154 | Metadata: mapToS3Metadata(o.meta), |
| 4155 | MetadataDirective: types.MetadataDirectiveReplace, // replace metadata with that passed in |
| 4156 | } |
| 4157 | if o.fs.opt.RequesterPays { |
| 4158 | req.RequestPayer = types.RequestPayerRequester |
| 4159 | } |
| 4160 | return o.fs.copy(ctx, &req, bucket, bucketPath, bucket, bucketPath, o) |
| 4161 | } |
| 4162 | |
| 4163 | // Storable raturns a boolean indicating if this object is storable |
| 4164 | func (o *Object) Storable() bool { |
nothing calls this directly
no test coverage detected