local_windows.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Package local provides the default implementation for volumes. It
  2. // is used to mount data volume containers and directories local to
  3. // the host server.
  4. package local
  5. import (
  6. "fmt"
  7. "os"
  8. "path/filepath"
  9. "strings"
  10. "syscall"
  11. "time"
  12. )
  13. type optsConfig struct{}
  14. var validOpts map[string]bool
  15. // scopedPath verifies that the path where the volume is located
  16. // is under Docker's root and the valid local paths.
  17. func (r *Root) scopedPath(realPath string) bool {
  18. if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
  19. return true
  20. }
  21. return false
  22. }
  23. func setOpts(v *localVolume, opts map[string]string) error {
  24. if len(opts) > 0 {
  25. return fmt.Errorf("options are not supported on this platform")
  26. }
  27. return nil
  28. }
  29. func (v *localVolume) mount() error {
  30. return nil
  31. }
  32. func (v *localVolume) CreatedAt() (time.Time, error) {
  33. fileInfo, err := os.Stat(v.path)
  34. if err != nil {
  35. return time.Time{}, err
  36. }
  37. ft := fileInfo.Sys().(*syscall.Win32FileAttributeData).CreationTime
  38. return time.Unix(0, ft.Nanoseconds()), nil
  39. }