2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-21 20:35:12 +00:00

Add atime to storage

This commit is contained in:
Alexander Neumann 2014-04-27 23:59:58 +02:00
parent d35a52da23
commit 2717d681c5
2 changed files with 23 additions and 19 deletions

View File

@ -16,6 +16,7 @@ type Node struct {
Name string `json:"name"`
Mode os.FileMode `json:"mode"`
ModTime time.Time `json:"mtime"`
AccessTime time.Time `json:"atime"`
User uint32 `json:"user"`
Group uint32 `json:"group"`
Content ID `json:"content,omitempty"`
@ -47,6 +48,7 @@ func NodeFromFileInfo(fi os.FileInfo) Node {
if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
node.User = stat.Uid
node.Group = stat.Gid
node.AccessTime = time.Unix(stat.Atim.Unix())
}
return node

View File

@ -30,6 +30,7 @@ var _ = Describe("Tree", func() {
Name: "foobar",
Mode: 0755,
ModTime: parseTime("2014-04-20T22:16:54.161401+02:00"),
AccessTime: parseTime("2014-04-21T22:16:54.161401+02:00"),
User: 1000,
Group: 1001,
Content: []byte{0x41, 0x42, 0x43},
@ -39,12 +40,13 @@ var _ = Describe("Tree", func() {
Mode: 0755,
User: 1000,
ModTime: parseTime("2014-04-20T22:16:54.161401+02:00"),
AccessTime: parseTime("2014-04-21T22:16:54.161401+02:00"),
Group: 1001,
Content: []byte("\xde\xad\xbe\xef\xba\xdc\x0d\xe0"),
},
}
raw = `{"nodes":[{"name":"foobar","mode":493,"mtime":"2014-04-20T22:16:54.161401+02:00","user":1000,"group":1001,"content":"414243"},{"name":"baz","mode":493,"mtime":"2014-04-20T22:16:54.161401+02:00","user":1000,"group":1001,"content":"deadbeefbadc0de0"}]}`
raw = `{"nodes":[{"name":"foobar","mode":493,"mtime":"2014-04-20T22:16:54.161401+02:00","atime":"2014-04-21T22:16:54.161401+02:00","user":1000,"group":1001,"content":"414243"},{"name":"baz","mode":493,"mtime":"2014-04-20T22:16:54.161401+02:00","atime":"2014-04-21T22:16:54.161401+02:00","user":1000,"group":1001,"content":"deadbeefbadc0de0"}]}`
})
It("Should save", func() {