MCPcopy Index your code
hub / github.com/rclone/rclone / SetModTime

Method SetModTime

backend/s3/s3.go:4134–4161  ·  view source on GitHub ↗

SetModTime sets the modification time of the local fs object

(ctx context.Context, modTime time.Time)

Source from the content-addressed store, hash-verified

4132
4133// SetModTime sets the modification time of the local fs object
4134func (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
4164func (o *Object) Storable() bool {

Callers

nothing calls this directly

Calls 6

readMetaDataMethod · 0.95
splitMethod · 0.95
MimeTypeFunction · 0.92
mapToS3MetadataFunction · 0.85
StringMethod · 0.65
copyMethod · 0.45

Tested by

no test coverage detected