Documentation ¶
Index ¶
- Variables
- type AllocDir
- func (d *AllocDir) BlockUntilExists(path string, t *tomb.Tomb) (chan error, error)
- func (d *AllocDir) Build() error
- func (d *AllocDir) ChangeEvents(path string, curOffset int64, t *tomb.Tomb) (*watch.FileChanges, error)
- func (d *AllocDir) Destroy() error
- func (d *AllocDir) List(path string) ([]*AllocFileInfo, error)
- func (d *AllocDir) Move(other *AllocDir, tasks []*structs.Task) error
- func (d *AllocDir) NewTaskDir(name string) *TaskDir
- func (d *AllocDir) ReadAt(path string, offset int64) (io.ReadCloser, error)
- func (d *AllocDir) Snapshot(w io.Writer) error
- func (d *AllocDir) Stat(path string) (*AllocFileInfo, error)
- func (d *AllocDir) UnmountAll() error
- type AllocDirFS
- type AllocFileInfo
- type TaskDir
Constants ¶
This section is empty.
Variables ¶
var ( // Name of the directory where logs of Tasks are written LogDirName = "logs" // included in snapshots. SharedDataDir = "data" // TmpDirName is the name of the temporary directory in each alloc and // task. TmpDirName = "tmp" SharedAllocDirs = []string{LogDirName, TmpDirName, SharedDataDir} // The name of the directory that exists inside each task directory // regardless of driver. TaskLocal = "local" // TaskSecrets is the name of the secret directory inside each task // directory TaskSecrets = "secrets" // TaskDirs is the set of directories created in each tasks directory. TaskDirs = map[string]os.FileMode{TmpDirName: os.ModeSticky | 0777} )SharedAllocName = "alloc"
var ( // directory shared across tasks in a task group. SharedAllocContainerPath = filepath.Join("/", SharedAllocName) // TaskLocalContainer is the path inside a container for mounted directory // for local storage. TaskLocalContainerPath = filepath.Join("/", TaskLocal) // TaskSecretsContainerPath is the path inside a container for mounted // secrets directory TaskSecretsContainerPath = filepath.Join("/", TaskSecrets) )
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]*TaskDir // contains filtered or unexported fields }
func NewAllocDir ¶
NewAllocDir initializes the AllocDir struct with allocDir as base path for the allocation directory.
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) 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) Move ¶ added in v0.5.0
Move other alloc directory's shared path and local dir to this alloc dir.
func (*AllocDir) NewTaskDir ¶ added in v0.5.3
NewTaskDir creates a new TaskDir and adds it to the AllocDirs TaskDirs map.
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) Snapshot ¶ added in v0.5.0
Snapshot creates an archive of the files and directories in the data dir of the allocation and the task local directories
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
UnmountAll linked/mounted directories in task dirs.
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) Snapshot(w io.Writer) error BlockUntilExists(path string, t *tomb.Tomb) (chan error, error) ChangeEvents(path string, curOffset int64, t *tomb.Tomb) (*watch.FileChanges, 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
type TaskDir ¶ added in v0.5.3
type TaskDir struct { // Dir is the path to Task directory on the host Dir string // <alloc_dir>/alloc/ SharedAllocDir string // the task directory on the host. // <task_dir>/alloc/ SharedTaskDir string // LocalDir is the path to the task's local directory on the host // <task_dir>/local/ LocalDir string // LogDir is the path to the task's log directory on the host // <alloc_dir>/alloc/logs/ LogDir string // SecretsDir is the path to secrets/ directory on the host // <task_dir>/secrets/ SecretsDir string // contains filtered or unexported fields }
TaskDir contains all of the paths relevant to a task. All paths are on the host system so drivers should mount/link into task containers as necessary.