github.com/moby/docker@v26.1.3+incompatible/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/docker/docker/volume/local"
     5  
     6  import (
     7  	"os"
     8  	"syscall"
     9  	"time"
    10  
    11  	"github.com/docker/docker/errdefs"
    12  	"github.com/pkg/errors"
    13  )
    14  
    15  type optsConfig struct{}
    16  
    17  func (r *Root) validateOpts(opts map[string]string) error {
    18  	if len(opts) == 0 {
    19  		return nil
    20  	}
    21  	return errdefs.InvalidParameter(errors.New("options are not supported on this platform"))
    22  }
    23  
    24  func (v *localVolume) setOpts(opts map[string]string) error {
    25  	// Windows does not support any options currently
    26  	return nil
    27  }
    28  
    29  func (v *localVolume) needsMount() bool {
    30  	return false
    31  }
    32  
    33  func (v *localVolume) mount() error {
    34  	return nil
    35  }
    36  
    37  func (v *localVolume) unmount() error {
    38  	return nil
    39  }
    40  
    41  func unmount(_ string) {}
    42  
    43  func (v *localVolume) postMount() error {
    44  	return nil
    45  }
    46  
    47  // restoreIfMounted is a no-op on Windows (because mounts are not supported).
    48  func (v *localVolume) restoreIfMounted() error {
    49  	return nil
    50  }
    51  
    52  func (v *localVolume) CreatedAt() (time.Time, error) {
    53  	fileInfo, err := os.Stat(v.rootPath)
    54  	if err != nil {
    55  		return time.Time{}, err
    56  	}
    57  	ft := fileInfo.Sys().(*syscall.Win32FileAttributeData).CreationTime
    58  	return time.Unix(0, ft.Nanoseconds()), nil
    59  }