fs: define the optional interface SetMetadata and implement it in wrapping backends

This also implements backend integration tests for the feature
This commit is contained in:
Nick Craig-Wood 2024-05-08 17:06:55 +01:00
parent e9e9feb21e
commit cc634213a5
8 changed files with 121 additions and 0 deletions

View file

@ -1248,6 +1248,17 @@ func (o *Object) Metadata(ctx context.Context) (fs.Metadata, error) {
return do.Metadata(ctx)
}
// SetMetadata sets metadata for an Object
//
// It should return fs.ErrorNotImplemented if it can't set metadata
func (o *Object) SetMetadata(ctx context.Context, metadata fs.Metadata) error {
do, ok := o.Object.(fs.SetMetadataer)
if !ok {
return fs.ErrorNotImplemented
}
return do.SetMetadata(ctx, metadata)
}
// MimeType returns the content type of the Object if
// known, or "" if not
//