github.com/beornf/libcompose@v0.4.1-0.20210215180846-a59802c0f07c/project/interface.go (about) 1 package project 2 3 import ( 4 "golang.org/x/net/context" 5 6 "github.com/docker/libcompose/config" 7 "github.com/docker/libcompose/project/events" 8 "github.com/docker/libcompose/project/options" 9 ) 10 11 // APIProject defines the methods a libcompose project should implement. 12 type APIProject interface { 13 events.Notifier 14 events.Emitter 15 16 Build(ctx context.Context, options options.Build, sevice ...string) error 17 Config() (string, error) 18 Create(ctx context.Context, options options.Create, services ...string) error 19 Delete(ctx context.Context, options options.Delete, services ...string) error 20 Down(ctx context.Context, options options.Down, services ...string) error 21 Events(ctx context.Context, services ...string) (chan events.ContainerEvent, error) 22 Kill(ctx context.Context, signal string, services ...string) error 23 Log(ctx context.Context, follow bool, services ...string) error 24 Pause(ctx context.Context, services ...string) error 25 Ps(ctx context.Context, services ...string) (InfoSet, error) 26 // FIXME(vdemeester) we could use nat.Port instead ? 27 Port(ctx context.Context, index int, protocol, serviceName, privatePort string) (string, error) 28 Pull(ctx context.Context, services ...string) error 29 Restart(ctx context.Context, timeout int, services ...string) error 30 Run(ctx context.Context, serviceName string, commandParts []string, options options.Run) (int, error) 31 Scale(ctx context.Context, timeout int, servicesScale map[string]int) error 32 Start(ctx context.Context, services ...string) error 33 Stop(ctx context.Context, timeout int, services ...string) error 34 Unpause(ctx context.Context, services ...string) error 35 Up(ctx context.Context, options options.Up, services ...string) error 36 37 Parse() error 38 CreateService(name string) (Service, error) 39 AddConfig(name string, config *config.ServiceConfig) error 40 Load(bytes []byte) error 41 Containers(ctx context.Context, filter Filter, services ...string) ([]string, error) 42 43 GetServiceConfig(service string) (*config.ServiceConfig, bool) 44 } 45 46 // Filter holds filter element to filter containers 47 type Filter struct { 48 State State 49 } 50 51 // State defines the supported state you can filter on 52 type State string 53 54 // Definitions of filter states 55 const ( 56 AnyState = State("") 57 Running = State("running") 58 Stopped = State("stopped") 59 ) 60 61 // RuntimeProject defines runtime-specific methods for a libcompose implementation. 62 type RuntimeProject interface { 63 RemoveOrphans(ctx context.Context, projectName string, serviceConfigs *config.ServiceConfigs) error 64 }