clean

package
v0.0.0-...-26c3727 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StopTimeEnd 时间到
	StopByTimeEnd StopType = "time"
	// StopByInterrupt 手动停止
	StopByInterrupt StopType = "interrupt"
	// TaskCleanNoneImage 删除none镜像
	TaskCleanNoneImage TaskType = "none"
	// TaskCleanPeriodImage 删除存在某一段时间的镜像
	TaskCleanPeriodImage TaskType = "period"
	// StatusNotActived 任务未激活状态
	StatusNotActived Status = "NotActived"
	// StatusInActived 任务已激活
	StatusInActived Status = "InActived"
	// StatusCompleted 任务已完成
	StatusCompleted Status = "Completed"
)
View Source
const (
	// DockerUnixSock socket file for communicate with docker daemon
	DockerUnixSock = "/var/run/docker.sock"
)
View Source
const Format = "3:04:05"

Variables

This section is empty.

Functions

func CheckFileExist

func CheckFileExist(path string) (bool, error)

CheckFileExist returns whether the given file or directory exists or not

func Clean

func Clean(cmd *cobra.Command, args []string) (err error)

Clean clean the garbage in docker

Types

type Job

type Job interface {
	Start()
	Stop()
}

type NoneImageJob

type NoneImageJob struct {
	Status Status

	StartTime string
	StopTime  string
	// contains filtered or unexported fields
}

NoneImageJob clean none image job

func (*NoneImageJob) NoneImage

func (j *NoneImageJob) NoneImage()

NoneImage remove none tag image

func (*NoneImageJob) Start

func (j *NoneImageJob) Start()

Start start job

func (*NoneImageJob) Stop

func (j *NoneImageJob) Stop()

Stop stop job

type Schedule

type Schedule struct {
	DockerHost    string
	ExcludeImages []string

	Tasks map[TaskType]Job
	// contains filtered or unexported fields
}

Schedule for clean docker

func (*Schedule) Init

func (s *Schedule) Init() (err error)

Init init the Schedule

func (*Schedule) Start

func (s *Schedule) Start()

Start schedule

func (*Schedule) Stop

func (s *Schedule) Stop()

Stop schedule

type Status

type Status string

Status 任务状态

type StopType

type StopType string

type Task

type Task struct {
	StartTime  *time.Time
	StopTime   *time.Time
	TaskType   TaskType
	Status     Status
	StopSignal chan struct{}
	// contains filtered or unexported fields
}

Task 具体任务

func (*Task) NoneImage

func (t *Task) NoneImage(force bool, stop chan StopType) (err error)

NoneImage remove none tag image force force remove when running container with

func (*Task) PeriodImage

func (t *Task) PeriodImage(s *Schedule) (err error)

PeriodImage 删除存在某一段时间的镜像

func (*Task) Start

func (t *Task) Start()

Start start the task

func (*Task) Stop

func (t *Task) Stop()

Stop stop task

type TaskType

type TaskType string

TaskType 任务类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL