-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathfileinfo.go
52 lines (42 loc) · 893 Bytes
/
fileinfo.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
52
package fscache
import (
"os"
"time"
)
// FileInfo is just a wrapper around os.FileInfo which includes atime.
type FileInfo struct {
os.FileInfo
Atime time.Time
}
type fileInfo struct {
name string
size int64
fileMode os.FileMode
isDir bool
sys interface{}
wt time.Time
}
func (f *fileInfo) Name() string {
return f.name
}
func (f *fileInfo) Size() int64 {
return f.size
}
func (f *fileInfo) Mode() os.FileMode {
return f.fileMode
}
func (f *fileInfo) ModTime() time.Time {
return f.wt
}
func (f *fileInfo) IsDir() bool {
return f.isDir
}
func (f *fileInfo) Sys() interface{} {
return f.sys
}
// AccessTime returns the last time the file was read.
// It will be used to check expiry of a file, and must be concurrent safe
// with modifications to the FileSystem (writes, reads etc.)
func (f *FileInfo) AccessTime() time.Time {
return f.Atime
}