mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
fs: implement optional Metadata interface for Objects #111
This implements integration tests for the feature also.
This commit is contained in:
13
fs/types.go
13
fs/types.go
@@ -183,6 +183,14 @@ type GetTierer interface {
|
||||
GetTier() string
|
||||
}
|
||||
|
||||
// Metadataer is an optional interface for Object
|
||||
type Metadataer interface {
|
||||
// Metadata returns metadata for an object
|
||||
//
|
||||
// It should return nil if there is no Metadata
|
||||
Metadata(ctx context.Context) (Metadata, error)
|
||||
}
|
||||
|
||||
// FullObjectInfo contains all the read-only optional interfaces
|
||||
//
|
||||
// Use for checking making wrapping ObjectInfos implement everything
|
||||
@@ -192,6 +200,7 @@ type FullObjectInfo interface {
|
||||
IDer
|
||||
ObjectUnWrapper
|
||||
GetTierer
|
||||
Metadataer
|
||||
}
|
||||
|
||||
// FullObject contains all the optional interfaces for Object
|
||||
@@ -204,6 +213,7 @@ type FullObject interface {
|
||||
ObjectUnWrapper
|
||||
GetTierer
|
||||
SetTierer
|
||||
Metadataer
|
||||
}
|
||||
|
||||
// ObjectOptionalInterfaces returns the names of supported and
|
||||
@@ -232,6 +242,9 @@ func ObjectOptionalInterfaces(o Object) (supported, unsupported []string) {
|
||||
_, ok = o.(GetTierer)
|
||||
store(ok, "GetTier")
|
||||
|
||||
_, ok = o.(Metadataer)
|
||||
store(ok, "Metadata")
|
||||
|
||||
return supported, unsupported
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user