1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

fs: add Optional ID() method to Object and implement it in backends

ID() shows the internal ID of the Object if available.
This commit is contained in:
Nick Craig-Wood
2018-05-13 09:16:56 +01:00
parent 6791cf7d7f
commit 826975c341
9 changed files with 57 additions and 0 deletions

View File

@@ -1110,6 +1110,11 @@ func (o *Object) Remove() error {
return nil
}
// ID returns the ID of the Object if known, or "" if not
func (o *Object) ID() string {
return o.info.GetHash()
}
// Check the interfaces are satisfied
var (
_ fs.Fs = (*Fs)(nil)
@@ -1122,4 +1127,5 @@ var (
_ fs.MergeDirser = (*Fs)(nil)
_ fs.Abouter = (*Fs)(nil)
_ fs.Object = (*Object)(nil)
_ fs.IDer = (*Object)(nil)
)