mirror of
https://github.com/docker/compose.git
synced 2026-08-27 03:45:29 +00:00
Merge pull request #1415 from ulyssessouza/add-restart
Add restart command
This commit is contained in:
commit
e0344ea7b4
17 changed files with 281 additions and 0 deletions
|
|
@ -48,6 +48,10 @@ func (c *composeService) Start(ctx context.Context, project *types.Project, opti
|
|||
return errdefs.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (c *composeService) Restart(ctx context.Context, project *types.Project, options compose.RestartOptions) error {
|
||||
return errdefs.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (c *composeService) Stop(ctx context.Context, project *types.Project, options compose.StopOptions) error {
|
||||
return errdefs.ErrNotImplemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ type Service interface {
|
|||
Create(ctx context.Context, project *types.Project, opts CreateOptions) error
|
||||
// Start executes the equivalent to a `compose start`
|
||||
Start(ctx context.Context, project *types.Project, options StartOptions) error
|
||||
// Restart restarts containers
|
||||
Restart(ctx context.Context, project *types.Project, options RestartOptions) error
|
||||
// Stop executes the equivalent to a `compose stop`
|
||||
Stop(ctx context.Context, project *types.Project, options StopOptions) error
|
||||
// Up executes the equivalent to a `compose up`
|
||||
|
|
@ -106,6 +108,12 @@ type StartOptions struct {
|
|||
Services []string
|
||||
}
|
||||
|
||||
// RestartOptions group options of the Restart API
|
||||
type RestartOptions struct {
|
||||
// Timeout override container restart timeout
|
||||
Timeout *time.Duration
|
||||
}
|
||||
|
||||
// StopOptions group options of the Stop API
|
||||
type StopOptions struct {
|
||||
// Timeout override container stop timeout
|
||||
|
|
|
|||
|
|
@ -68,6 +68,16 @@ func StartedEvent(ID string) Event {
|
|||
return NewEvent(ID, Done, "Started")
|
||||
}
|
||||
|
||||
// RestartingEvent creates a new Restarting in progress Event
|
||||
func RestartingEvent(ID string) Event {
|
||||
return NewEvent(ID, Working, "Restarting")
|
||||
}
|
||||
|
||||
// RestartedEvent creates a new Restarted in progress Event
|
||||
func RestartedEvent(ID string) Event {
|
||||
return NewEvent(ID, Done, "Restarted")
|
||||
}
|
||||
|
||||
// RunningEvent creates a new Running in progress Event
|
||||
func RunningEvent(ID string) Event {
|
||||
return NewEvent(ID, Done, "Running")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue