github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/volume/local/local_windows.go (about)

     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 // import "github.com/demonoid81/moby/volume/local"
     5  
     6  import (
     7  	"os"
     8  	"path/filepath"
     9  	"strings"
    10  	"syscall"
    11  	"time"
    12  
    13  	"github.com/demonoid81/moby/errdefs"
    14  	"github.com/pkg/errors"
    15  )
    16  
    17  type optsConfig struct{}
    18  
    19  // scopedPath verifies that the path where the volume is located
    20  // is under Docker's root and the valid local paths.
    21  func (r *Root) scopedPath(realPath string) bool {
    22  	if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
    23  		return true
    24  	}
    25  	return false
    26  }
    27  
    28  func setOpts(v *localVolume, opts map[string]string) error {
    29  	if len(opts) > 0 {
    30  		return errdefs.InvalidParameter(errors.New("options are not supported on this platform"))
    31  	}
    32  	return nil
    33  }
    34  
    35  func (v *localVolume) mount() error {
    36  	return nil
    37  }
    38  
    39  func (v *localVolume) CreatedAt() (time.Time, error) {
    40  	fileInfo, err := os.Stat(v.path)
    41  	if err != nil {
    42  		return time.Time{}, err
    43  	}
    44  	ft := fileInfo.Sys().(*syscall.Win32FileAttributeData).CreationTime
    45  	return time.Unix(0, ft.Nanoseconds()), nil
    46  }