github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/client/allocdir/fs_windows.go (about)

     1  package allocdir
     2  
     3  import (
     4  	"errors"
     5  	"os"
     6  	"path/filepath"
     7  )
     8  
     9  var (
    10  	// SharedAllocContainerPath is the path inside container for mounted
    11  	// directory shared across tasks in a task group.
    12  	SharedAllocContainerPath = filepath.Join("c:\\", SharedAllocName)
    13  
    14  	// TaskLocalContainer is the path inside a container for mounted directory
    15  	// for local storage.
    16  	TaskLocalContainerPath = filepath.Join("c:\\", TaskLocal)
    17  
    18  	// TaskSecretsContainerPath is the path inside a container for mounted
    19  	// secrets directory
    20  	TaskSecretsContainerPath = filepath.Join("c:\\", TaskSecrets)
    21  )
    22  
    23  // linkOrCopy is always copies dst to src on Windows.
    24  func linkOrCopy(src, dst string, uid, gid int, perm os.FileMode) error {
    25  	return fileCopy(src, dst, uid, gid, perm)
    26  }
    27  
    28  // The windows version does nothing currently.
    29  func mountSharedDir(dir string) error {
    30  	return errors.New("Mount on Windows not supported.")
    31  }
    32  
    33  // The windows version does nothing currently.
    34  func linkDir(src, dst string) error {
    35  	return nil
    36  }
    37  
    38  // The windows version does nothing currently.
    39  func unlinkDir(dir string) error {
    40  	return nil
    41  }
    42  
    43  // createSecretDir creates the secrets dir folder at the given path
    44  func createSecretDir(dir string) error {
    45  	return os.MkdirAll(dir, 0777)
    46  }
    47  
    48  // removeSecretDir removes the secrets dir folder
    49  func removeSecretDir(dir string) error {
    50  	return os.RemoveAll(dir)
    51  }
    52  
    53  // The windows version does nothing currently.
    54  func dropDirPermissions(path string, desired os.FileMode) error {
    55  	return nil
    56  }
    57  
    58  // The windows version does nothing currently.
    59  func unmountSharedDir(dir string) error {
    60  	return nil
    61  }
    62  
    63  // MountSpecialDirs mounts the dev and proc file system on the chroot of the
    64  // task. It's a no-op on windows.
    65  func MountSpecialDirs(taskDir string) error {
    66  	return nil
    67  }
    68  
    69  // unmountSpecialDirs unmounts the dev and proc file system from the chroot
    70  func unmountSpecialDirs(taskDir string) error {
    71  	return nil
    72  }
    73  
    74  // getOwner doesn't work on Windows as Windows doesn't use int user IDs
    75  func getOwner(os.FileInfo) (int, int) {
    76  	return idUnsupported, idUnsupported
    77  }