-
Notifications
You must be signed in to change notification settings - Fork 13
/
file.go
51 lines (38 loc) · 981 Bytes
/
file.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package goss
import (
"time"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
)
// File A slice of File is returned when all files are fetched through Store.Files.
// File hides differences in object returns from different cloud storage providers,
// but at the same time, it can only return less information.
type File interface {
// Key is the object key.
Key() string
// Type is the object type.
Type() string
// Size is the size of current file.
Size() int64
// ETag is etag return by cloud storage providers.
ETag() string
// LastModified is the time when the object was last updated.
LastModified() time.Time
}
type file struct {
item types.Object
}
func (f *file) Key() string {
return *f.item.Key
}
func (f *file) Type() string {
return string(f.item.StorageClass)
}
func (f *file) Size() int64 {
return f.item.Size
}
func (f *file) ETag() string {
return *f.item.ETag
}
func (f *file) LastModified() time.Time {
return *f.item.LastModified
}