Documentation ¶
Overview ¶
Functions shared between linux/darwin.
Index ¶
- Variables
- type AllocDir
- func (d *AllocDir) BlockUntilExists(path string, t *tomb.Tomb) chan error
- func (d *AllocDir) Build(tasks []*structs.Task) error
- func (d *AllocDir) ChangeEvents(path string, curOffset int64, t *tomb.Tomb) (*watch.FileChanges, error)
- func (d *AllocDir) Destroy() error
- func (d *AllocDir) Embed(task string, entries map[string]string) error
- func (d *AllocDir) List(path string) ([]*AllocFileInfo, error)
- func (d *AllocDir) LogDir() string
- func (d *AllocDir) MountSharedDir(task string) error
- func (d *AllocDir) MountSpecialDirs(taskDir string) error
- func (d *AllocDir) ReadAt(path string, offset int64) (io.ReadCloser, error)
- func (d *AllocDir) Stat(path string) (*AllocFileInfo, error)
- func (d *AllocDir) UnmountAll() error
- type AllocDirFS
- type AllocFileInfo
Constants ¶
This section is empty.
Variables ¶
var ( // Name of the directory where logs of Tasks are written LogDirName = "logs" SharedAllocDirs = []string{LogDirName, "tmp", "data"} // The name of the directory that exists inside each task directory // regardless of driver. TaskLocal = "local" // TaskDirs is the set of directories created in each tasks directory. TaskDirs = []string{"tmp"} )SharedAllocName = "alloc"
var ( filepath.Join("/", SharedAllocName) //Path inside container for mounted directory for local storage. TaskLocalContainerPath = filepath.Join("/", TaskLocal) )SharedAllocContainerPath =
Functions ¶
This section is empty.
Types ¶
type AllocDir ¶
type AllocDir struct { // AllocDir is the directory used for storing any state // of this allocation. It will be purged on alloc destroy. AllocDir string // group. SharedDir string // TaskDirs is a mapping of task names to their non-shared directory. TaskDirs map[string]string }
func NewAllocDir ¶
func (*AllocDir) BlockUntilExists ¶ added in v0.4.1
BlockUntilExists blocks until the passed file relative the allocation directory exists. The block can be cancelled with the passed tomb.
func (*AllocDir) ChangeEvents ¶ added in v0.4.1
func (d *AllocDir) ChangeEvents(path string, curOffset int64, t *tomb.Tomb) (*watch.FileChanges, error)
ChangeEvents watches for changes to the passed path relative to the allocation directory. The offset should be the last read offset. The tomb is used to clean up the watch.
func (*AllocDir) Embed ¶
Embed takes a mapping of absolute directory or file paths on the host to their intended, relative location within the task directory. Embed attempts hardlink and then defaults to copying. If the path exists on the host and can't be embedded an error is returned.
func (*AllocDir) List ¶ added in v0.3.0
func (d *AllocDir) List(path string) ([]*AllocFileInfo, error)
List returns the list of files at a path relative to the alloc dir
func (*AllocDir) LogDir ¶ added in v0.3.0
LogDir returns the log dir in the current allocation directory
func (*AllocDir) MountSharedDir ¶
MountSharedDir mounts the shared directory into the specified task's directory. Mount is documented at an OS level in their respective implementation files.
func (*AllocDir) MountSpecialDirs ¶ added in v0.3.0
MountSpecialDirs mounts the dev and proc file system from the host to the chroot
func (*AllocDir) ReadAt ¶ added in v0.3.0
ReadAt returns a reader for a file at the path relative to the alloc dir
func (*AllocDir) Stat ¶ added in v0.3.0
func (d *AllocDir) Stat(path string) (*AllocFileInfo, error)
Stat returns information about the file at a path relative to the alloc dir
func (*AllocDir) UnmountAll ¶ added in v0.3.0
type AllocDirFS ¶ added in v0.3.0
type AllocDirFS interface { List(path string) ([]*AllocFileInfo, error) Stat(path string) (*AllocFileInfo, error) ReadAt(path string, offset int64) (io.ReadCloser, error) BlockUntilExists(path string, t *tomb.Tomb) chan error ChangeEvents(path string, curOffset int64, t *tomb.Tomb) (*watch.FileChanges, error) }
AllocDirFS exposes file operations on the alloc dir