Documentation ¶
Overview ¶
Package cron is a generated GoMock package.
Index ¶
- type ContainerJob
- type Cron
- func (c *Cron) AddContainerJob(job ContainerJob) error
- func (c *Cron) AddJob(job Job) error
- func (c *Cron) AddJobs(jobs []Job) error
- func (c *Cron) AddServiceJob(job ServiceJob) error
- func (c *Cron) LoadConfig(filename string) error
- func (c *Cron) RemoveContainerJob(ID string)
- func (c *Cron) RemoveServiceJob(ID string)
- func (c *Cron) Start()
- func (c *Cron) Stop() context.Context
- type Cronner
- type DockerClient
- type Handler
- type Job
- type JobSynchroniser
- type MockCronner
- type MockCronnerMockRecorder
- func (mr *MockCronnerMockRecorder) AddContainerJob(job interface{}) *gomock.Call
- func (mr *MockCronnerMockRecorder) AddServiceJob(job interface{}) *gomock.Call
- func (mr *MockCronnerMockRecorder) RemoveContainerJob(ID interface{}) *gomock.Call
- func (mr *MockCronnerMockRecorder) RemoveServiceJob(ID interface{}) *gomock.Call
- type MockDockerClient
- func (m *MockDockerClient) Close() error
- func (m *MockDockerClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
- func (m *MockDockerClient) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
- func (m *MockDockerClient) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
- func (m *MockDockerClient) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
- func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (m *MockDockerClient) ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
- func (m *MockDockerClient) ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
- func (m *MockDockerClient) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
- func (m *MockDockerClient) EXPECT() *MockDockerClientMockRecorder
- func (m *MockDockerClient) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
- func (m *MockDockerClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
- func (m *MockDockerClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, ...) (types.ServiceUpdateResponse, error)
- type MockDockerClientMockRecorder
- func (mr *MockDockerClientMockRecorder) Close() *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerExecAttach(ctx, execID, config interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerExecCreate(ctx, container, config interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerExecInspect(ctx, execID interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerInspect(ctx, container interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerList(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerRestart(ctx, container, timeout interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerStart(ctx, container, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ContainerStop(ctx, container, timeout interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) Events(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ServiceList(ctx, options interface{}) *gomock.Call
- func (mr *MockDockerClientMockRecorder) ServiceUpdate(ctx, serviceID, version, service, options interface{}) *gomock.Call
- type MockJobSynchroniser
- type MockJobSynchroniserMockRecorder
- type MockRunner
- type MockRunnerMockRecorder
- type Runner
- type ServiceJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerJob ¶
type ContainerJob struct { Schedule string Action string Timeout string Command string Container types.Container // contains filtered or unexported fields }
ContainerJob run a docker container on a schedule.
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
Cron keeps track of any number of jobs, invoking the associated Job as specified by the schedule. It may be started and stopped.
func (*Cron) AddContainerJob ¶
func (c *Cron) AddContainerJob(job ContainerJob) error
AddContainerJob add container job to the Cron to be run on the given schedule.
func (*Cron) AddServiceJob ¶
func (c *Cron) AddServiceJob(job ServiceJob) error
AddServiceJob add service job to the Cron to be run on the given schedule.
func (*Cron) LoadConfig ¶
LoadConfig read Job from file in JSON format and add them to Cron.
func (*Cron) RemoveContainerJob ¶
RemoveContainerJob remove container job from Cron.
func (*Cron) RemoveServiceJob ¶
RemoveServiceJob remove service job from Cron.
type Cronner ¶
type Cronner interface { AddContainerJob(job ContainerJob) error AddServiceJob(job ServiceJob) error RemoveContainerJob(ID string) RemoveServiceJob(ID string) }
Cronner is an interface for adding job to cron
type DockerClient ¶
type DockerClient interface { Close() error ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error ContainerStop(ctx context.Context, container string, timeout *time.Duration) error ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) }
DockerClient is the client for docker
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handle docker messages
func NewHandler ¶
NewHandler returns a docker handler
func (*Handler) ListenContainer ¶
func (h *Handler) ListenContainer()
ListenContainer listen docker message for containers with cron schedule
func (*Handler) ListenService ¶
func (h *Handler) ListenService()
ListenService listen docker message for services with cron schedule
func (*Handler) ScanContainer ¶
ScanContainer scan current containers for cron schedule
func (*Handler) ScanService ¶
ScanService scan current service for cron schedule
type Job ¶
type Job struct { Schedule string `json:"schedule"` Command string `json:"command"` Args []string `json:"args"` // contains filtered or unexported fields }
Job run a command with specified args on a schedule.
type JobSynchroniser ¶
type JobSynchroniser interface { Add(delta int) Done() Wait() }
JobSynchroniser is an interface for testing sync.WaitGroup
type MockCronner ¶
type MockCronner struct {
// contains filtered or unexported fields
}
MockCronner is a mock of Cronner interface
func NewMockCronner ¶
func NewMockCronner(ctrl *gomock.Controller) *MockCronner
NewMockCronner creates a new mock instance
func (*MockCronner) AddContainerJob ¶
func (m *MockCronner) AddContainerJob(job ContainerJob) error
AddContainerJob mocks base method
func (*MockCronner) AddServiceJob ¶
func (m *MockCronner) AddServiceJob(job ServiceJob) error
AddServiceJob mocks base method
func (*MockCronner) EXPECT ¶
func (m *MockCronner) EXPECT() *MockCronnerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockCronner) RemoveContainerJob ¶
func (m *MockCronner) RemoveContainerJob(ID string)
RemoveContainerJob mocks base method
func (*MockCronner) RemoveServiceJob ¶
func (m *MockCronner) RemoveServiceJob(ID string)
RemoveServiceJob mocks base method
type MockCronnerMockRecorder ¶
type MockCronnerMockRecorder struct {
// contains filtered or unexported fields
}
MockCronnerMockRecorder is the mock recorder for MockCronner
func (*MockCronnerMockRecorder) AddContainerJob ¶
func (mr *MockCronnerMockRecorder) AddContainerJob(job interface{}) *gomock.Call
AddContainerJob indicates an expected call of AddContainerJob
func (*MockCronnerMockRecorder) AddServiceJob ¶
func (mr *MockCronnerMockRecorder) AddServiceJob(job interface{}) *gomock.Call
AddServiceJob indicates an expected call of AddServiceJob
func (*MockCronnerMockRecorder) RemoveContainerJob ¶
func (mr *MockCronnerMockRecorder) RemoveContainerJob(ID interface{}) *gomock.Call
RemoveContainerJob indicates an expected call of RemoveContainerJob
func (*MockCronnerMockRecorder) RemoveServiceJob ¶
func (mr *MockCronnerMockRecorder) RemoveServiceJob(ID interface{}) *gomock.Call
RemoveServiceJob indicates an expected call of RemoveServiceJob
type MockDockerClient ¶
type MockDockerClient struct {
// contains filtered or unexported fields
}
MockDockerClient is a mock of DockerClient interface
func NewMockDockerClient ¶
func NewMockDockerClient(ctrl *gomock.Controller) *MockDockerClient
NewMockDockerClient creates a new mock instance
func (*MockDockerClient) ContainerExecAttach ¶
func (m *MockDockerClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
ContainerExecAttach mocks base method
func (*MockDockerClient) ContainerExecCreate ¶
func (m *MockDockerClient) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
ContainerExecCreate mocks base method
func (*MockDockerClient) ContainerExecInspect ¶
func (m *MockDockerClient) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
ContainerExecInspect mocks base method
func (*MockDockerClient) ContainerInspect ¶
func (m *MockDockerClient) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
ContainerInspect mocks base method
func (*MockDockerClient) ContainerList ¶
func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
ContainerList mocks base method
func (*MockDockerClient) ContainerRestart ¶
func (m *MockDockerClient) ContainerRestart(ctx context.Context, container string, timeout *time.Duration) error
ContainerRestart mocks base method
func (*MockDockerClient) ContainerStart ¶
func (m *MockDockerClient) ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error
ContainerStart mocks base method
func (*MockDockerClient) ContainerStop ¶
func (m *MockDockerClient) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
ContainerStop mocks base method
func (*MockDockerClient) EXPECT ¶
func (m *MockDockerClient) EXPECT() *MockDockerClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockDockerClient) Events ¶
func (m *MockDockerClient) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
Events mocks base method
func (*MockDockerClient) ServiceList ¶
func (m *MockDockerClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
ServiceList mocks base method
func (*MockDockerClient) ServiceUpdate ¶
func (m *MockDockerClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
ServiceUpdate mocks base method
type MockDockerClientMockRecorder ¶
type MockDockerClientMockRecorder struct {
// contains filtered or unexported fields
}
MockDockerClientMockRecorder is the mock recorder for MockDockerClient
func (*MockDockerClientMockRecorder) Close ¶
func (mr *MockDockerClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockDockerClientMockRecorder) ContainerExecAttach ¶
func (mr *MockDockerClientMockRecorder) ContainerExecAttach(ctx, execID, config interface{}) *gomock.Call
ContainerExecAttach indicates an expected call of ContainerExecAttach
func (*MockDockerClientMockRecorder) ContainerExecCreate ¶
func (mr *MockDockerClientMockRecorder) ContainerExecCreate(ctx, container, config interface{}) *gomock.Call
ContainerExecCreate indicates an expected call of ContainerExecCreate
func (*MockDockerClientMockRecorder) ContainerExecInspect ¶
func (mr *MockDockerClientMockRecorder) ContainerExecInspect(ctx, execID interface{}) *gomock.Call
ContainerExecInspect indicates an expected call of ContainerExecInspect
func (*MockDockerClientMockRecorder) ContainerInspect ¶
func (mr *MockDockerClientMockRecorder) ContainerInspect(ctx, container interface{}) *gomock.Call
ContainerInspect indicates an expected call of ContainerInspect
func (*MockDockerClientMockRecorder) ContainerList ¶
func (mr *MockDockerClientMockRecorder) ContainerList(ctx, options interface{}) *gomock.Call
ContainerList indicates an expected call of ContainerList
func (*MockDockerClientMockRecorder) ContainerRestart ¶
func (mr *MockDockerClientMockRecorder) ContainerRestart(ctx, container, timeout interface{}) *gomock.Call
ContainerRestart indicates an expected call of ContainerRestart
func (*MockDockerClientMockRecorder) ContainerStart ¶
func (mr *MockDockerClientMockRecorder) ContainerStart(ctx, container, options interface{}) *gomock.Call
ContainerStart indicates an expected call of ContainerStart
func (*MockDockerClientMockRecorder) ContainerStop ¶
func (mr *MockDockerClientMockRecorder) ContainerStop(ctx, container, timeout interface{}) *gomock.Call
ContainerStop indicates an expected call of ContainerStop
func (*MockDockerClientMockRecorder) Events ¶
func (mr *MockDockerClientMockRecorder) Events(ctx, options interface{}) *gomock.Call
Events indicates an expected call of Events
func (*MockDockerClientMockRecorder) ServiceList ¶
func (mr *MockDockerClientMockRecorder) ServiceList(ctx, options interface{}) *gomock.Call
ServiceList indicates an expected call of ServiceList
func (*MockDockerClientMockRecorder) ServiceUpdate ¶
func (mr *MockDockerClientMockRecorder) ServiceUpdate(ctx, serviceID, version, service, options interface{}) *gomock.Call
ServiceUpdate indicates an expected call of ServiceUpdate
type MockJobSynchroniser ¶
type MockJobSynchroniser struct {
// contains filtered or unexported fields
}
MockJobSynchroniser is a mock of JobSynchroniser interface
func NewMockJobSynchroniser ¶
func NewMockJobSynchroniser(ctrl *gomock.Controller) *MockJobSynchroniser
NewMockJobSynchroniser creates a new mock instance
func (*MockJobSynchroniser) Add ¶
func (m *MockJobSynchroniser) Add(delta int)
Add mocks base method
func (*MockJobSynchroniser) EXPECT ¶
func (m *MockJobSynchroniser) EXPECT() *MockJobSynchroniserMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockJobSynchroniserMockRecorder ¶
type MockJobSynchroniserMockRecorder struct {
// contains filtered or unexported fields
}
MockJobSynchroniserMockRecorder is the mock recorder for MockJobSynchroniser
func (*MockJobSynchroniserMockRecorder) Add ¶
func (mr *MockJobSynchroniserMockRecorder) Add(delta interface{}) *gomock.Call
Add indicates an expected call of Add
func (*MockJobSynchroniserMockRecorder) Done ¶
func (mr *MockJobSynchroniserMockRecorder) Done() *gomock.Call
Done indicates an expected call of Done
func (*MockJobSynchroniserMockRecorder) Wait ¶
func (mr *MockJobSynchroniserMockRecorder) Wait() *gomock.Call
Wait indicates an expected call of Wait
type MockRunner ¶
type MockRunner struct {
// contains filtered or unexported fields
}
MockRunner is a mock of Runner interface
func NewMockRunner ¶
func NewMockRunner(ctrl *gomock.Controller) *MockRunner
NewMockRunner creates a new mock instance
func (*MockRunner) EXPECT ¶
func (m *MockRunner) EXPECT() *MockRunnerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockRunnerMockRecorder ¶
type MockRunnerMockRecorder struct {
// contains filtered or unexported fields
}
MockRunnerMockRecorder is the mock recorder for MockRunner
func (*MockRunnerMockRecorder) AddJob ¶
func (mr *MockRunnerMockRecorder) AddJob(spec, cmd interface{}) *gomock.Call
AddJob indicates an expected call of AddJob
func (*MockRunnerMockRecorder) Remove ¶
func (mr *MockRunnerMockRecorder) Remove(id interface{}) *gomock.Call
Remove indicates an expected call of Remove
func (*MockRunnerMockRecorder) Start ¶
func (mr *MockRunnerMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start
func (*MockRunnerMockRecorder) Stop ¶
func (mr *MockRunnerMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop
type Runner ¶
type Runner interface { AddJob(spec string, cmd cron.Job) (cron.EntryID, error) Remove(id cron.EntryID) Start() Stop() context.Context }
Runner is an interface for testing robfig/cron