Initial windows runtime work

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-03-17 16:09:06 -07:00
parent e5c8c5634a
commit c5843b7615
120 changed files with 11158 additions and 596 deletions

View file

@ -8,7 +8,6 @@ import (
"os"
"path/filepath"
"strconv"
"syscall"
"time"
"github.com/containerd/containerd/log"
@ -156,19 +155,12 @@ func (s *Store) status(ingestPath string) (Status, error) {
return Status{}, err
}
var startedAt time.Time
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
startedAt = time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
} else {
startedAt = fi.ModTime()
}
return Status{
Ref: ref,
Offset: fi.Size(),
Total: s.total(ingestPath),
UpdatedAt: fi.ModTime(),
StartedAt: startedAt,
StartedAt: getStartTime(fi),
}, nil
}

17
content/store_unix.go Normal file
View file

@ -0,0 +1,17 @@
// +build linux
package content
import (
"os"
"syscall"
"time"
)
func getStartTime(fi os.FileInfo) time.Time {
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
}
return fi.ModTime()
}

10
content/store_windows.go Normal file
View file

@ -0,0 +1,10 @@
package content
import (
"os"
"time"
)
func getStartTime(fi os.FileInfo) time.Time {
return fi.ModTime()
}