Documentation ¶
Overview ¶
Functions shared between linux/darwin.
Index ¶
- Variables
- type AllocDir
- func (d *AllocDir) Build(tasks []*structs.Task) 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, limit int64) (io.ReadCloser, error)
- func (d *AllocDir) Stat(path string) (*AllocFileInfo, error)
- func (d *AllocDir) UnmountAll() error
- type AllocDirFS
- type AllocFileInfo
- type ReadCloserWrapper
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"
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) 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 which will read a chunk of bytes at a particular offset
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, limit int64) (io.ReadCloser, error) }
AllocDirFS exposes file operations on the alloc dir
type AllocFileInfo ¶ added in v0.3.0
AllocFileInfo holds information about a file inside the AllocDir