Documentation ¶
Index ¶
- func ListRunning() ([]string, error)
- type DStatusType
- type Dependency
- type DeployStatus
- type Event
- type EventNotFoundError
- type InvalidEventDataError
- type InvalidTaskInputError
- type InvalidTaskOutputError
- type Log
- type Option
- type Output
- type Parameter
- type ParameterWarning
- type Service
- func (service *Service) EventSubscriptionChannel() string
- func (s *Service) GetEvent(eventKey string) (*Event, error)
- func (s *Service) GetTask(taskKey string) (*Task, error)
- func (s *Service) Logs(dependencies ...string) ([]*Log, error)
- func (service *Service) ResultSubscriptionChannel() string
- func (s *Service) Start() (serviceIDs []string, err error)
- func (s *Service) Status() (StatusType, error)
- func (s *Service) Stop() error
- func (s *Service) StopDependencies() error
- func (service *Service) TaskSubscriptionChannel() string
- type StatusType
- type Task
- type TaskInputNotFoundError
- type TaskNotFoundError
- type TaskOutputNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListRunning ¶
ListRunning returns all the running services.2 TODO: should move to another file
Types ¶
type DStatusType ¶ added in v0.3.0
type DStatusType int
DStatusType indicates the type of status message.
const ( // DRunning indicates that status message belongs to a continuous state. DRunning DStatusType // DDonePositive indicates that status message belongs to a positive noncontinuous state. DDonePositive // DDoneNegative indicates that status message belongs to a negative noncontinuous state. DDoneNegative )
type Dependency ¶
type Dependency struct { // Key is the key of dependency. Key string `hash:"1"` // Image is the Docker image. Image string `hash:"name:2"` // Volumes are the Docker volumes. Volumes []string `hash:"name:3"` // VolumesFrom are the docker volumes-from from. VolumesFrom []string `hash:"name:4"` // Ports holds ports configuration for container. Ports []string `hash:"name:5"` // Command is the Docker command which will be executed when container started. Command string `hash:"name:6"` // contains filtered or unexported fields }
Dependency represents a Docker container and it holds instructions about how it should run.
func (*Dependency) Logs ¶ added in v0.3.0
func (d *Dependency) Logs() (rstd, rerr io.ReadCloser, err error)
Logs gives the dependency logs. rstd stands for standard logs and rerr stands for error logs.
func (*Dependency) Start ¶ added in v0.3.0
func (d *Dependency) Start(networkID string) (containerServiceID string, err error)
Start starts a dependency container.
func (*Dependency) Status ¶ added in v0.3.0
func (d *Dependency) Status() (container.StatusType, error)
Status returns StatusType of dependency's container.
func (*Dependency) Stop ¶ added in v0.3.0
func (d *Dependency) Stop() error
Stop stops a dependency.
type DeployStatus ¶ added in v0.3.0
type DeployStatus struct { Message string Type DStatusType }
DeployStatus represents the deployment status.
type Event ¶
type Event struct { // Key is the key of event. Key string `hash:"name:1"` // Name is the name of event. Name string `hash:"name:2"` // Description is the description of event. Description string `hash:"name:3"` // Data holds the input parameters of event. Data []*Parameter `hash:"name:4"` // contains filtered or unexported fields }
Event describes a service task.
func (*Event) RequireData ¶ added in v0.3.0
RequireData requires event datas to be matched with parameter schemas.
func (*Event) ValidateData ¶ added in v0.3.0
func (e *Event) ValidateData(eventData map[string]interface{}) []*ParameterWarning
ValidateData produces warnings for event datas that doesn't satisfy their parameter schemas.
type EventNotFoundError ¶ added in v0.2.0
EventNotFoundError is an error returned when corresponding event cannot be found in service.
func (*EventNotFoundError) Error ¶ added in v0.2.0
func (e *EventNotFoundError) Error() string
type InvalidEventDataError ¶ added in v0.2.0
type InvalidEventDataError struct { EventKey string ServiceName string Warnings []*ParameterWarning }
InvalidEventDataError is an error returned when the data of corresponding event is not valid.
func (*InvalidEventDataError) Error ¶ added in v0.2.0
func (e *InvalidEventDataError) Error() string
type InvalidTaskInputError ¶ added in v0.2.0
type InvalidTaskInputError struct { TaskKey string ServiceName string Warnings []*ParameterWarning }
InvalidTaskInputError is an error returned when the inputs of corresponding task are not valid.
func (*InvalidTaskInputError) Error ¶ added in v0.2.0
func (e *InvalidTaskInputError) Error() string
type InvalidTaskOutputError ¶ added in v0.3.0
type InvalidTaskOutputError struct { TaskKey string TaskOutputKey string ServiceName string Warnings []*ParameterWarning }
InvalidTaskOutputError is an error returned when the outputs of corresponding task are not valid.
func (*InvalidTaskOutputError) Error ¶ added in v0.3.0
func (e *InvalidTaskOutputError) Error() string
type Log ¶ added in v0.3.0
type Log struct { Dependency string Standard io.ReadCloser Error io.ReadCloser }
Log holds log streams of dependency.
type Option ¶ added in v0.3.0
type Option func(*Service)
Option is the configuration func of Service.
func ContainerOption ¶ added in v0.3.0
ContainerOption returns an option for customized container.
func DeployStatusOption ¶ added in v0.3.0
func DeployStatusOption(statuses chan DeployStatus) Option
DeployStatusOption receives chan statuses to send deploy statuses.
type Output ¶
type Output struct { // Key is the key of output. Key string `hash:"name:1"` // Name is the name of task output. Name string `hash:"name:2"` // Description is the description of task output. Description string `hash:"name:3"` // Data holds the output parameters of a task output. Data []*Parameter `hash:"name:4"` // contains filtered or unexported fields }
Output describes task output.
func (*Output) RequireData ¶ added in v0.3.0
RequireData requires task outputs to be matched with parameter schemas.
func (*Output) ValidateData ¶ added in v0.3.0
func (o *Output) ValidateData(outputData map[string]interface{}) []*ParameterWarning
ValidateData produces warnings for task outputs that doesn't satisfy their parameter schemas.
type Parameter ¶
type Parameter struct { // Key is the key of parameter. Key string `hash:"name:1"` // Name is the name of parameter. Name string `hash:"name:2"` // Description is the description of parameter. Description string `hash:"name:3"` // Type is the data type of parameter. Type string `hash:"name:4"` // Optional indicates if parameter is optional. Optional bool `hash:"name:5"` }
Parameter describes task input parameters, output parameters of a task output and input parameters of an event.
type ParameterWarning ¶ added in v0.2.0
ParameterWarning contains a specific warning related to a parameter.
func (*ParameterWarning) String ¶ added in v0.2.0
func (p *ParameterWarning) String() string
type Service ¶
type Service struct { // ID is the unique id of service. ID string `hash:"-"` // Name is the service name. Name string `hash:"name:1"` // Description is service description. Description string `hash:"name:2"` // Tasks are the list of tasks that service can execute. Tasks []*Task `hash:"name:3"` // Events are the list of events that service can emit. Events []*Event `hash:"name:4"` // Dependencies are the Docker containers that service can depend on. Dependencies []*Dependency `hash:"name:5"` // Repository holds the service's repository url if it's living on // a Git host. Repository string `hash:"name:6"` // DeployedAt holds the creation time of service. DeployedAt time.Time `hash:"-"` // contains filtered or unexported fields }
Service represents a MESG service.
func FromService ¶ added in v0.3.0
FromService upgrades service s by setting its options and private fields.
func (*Service) EventSubscriptionChannel ¶
EventSubscriptionChannel returns the channel to listen for events from this service.
func (*Service) Logs ¶
Logs gives service's logs and applies dependencies filter to filter logs. if dependencies has a length of zero all dependency logs will be provided.
func (*Service) ResultSubscriptionChannel ¶
ResultSubscriptionChannel returns the channel to listen for tasks from this service.
func (*Service) Status ¶
func (s *Service) Status() (StatusType, error)
Status returns StatusType of all dependency.
func (*Service) StopDependencies ¶
StopDependencies stops all dependencies.
func (*Service) TaskSubscriptionChannel ¶
TaskSubscriptionChannel returns the channel to listen for tasks from this service.
type StatusType ¶
type StatusType uint
StatusType of the service.
const ( UNKNOWN StatusType = iota STOPPED STARTING PARTIAL RUNNING )
Possible statuses for service.
func (StatusType) String ¶ added in v0.3.0
func (s StatusType) String() string
type Task ¶
type Task struct { // Key is the key of task. Key string `hash:"name:1"` // Name is the name of task. Name string `hash:"name:2"` // Description is the description of task. Description string `hash:"name:3"` // Inputs are the definition of the execution inputs of task. Inputs []*Parameter `hash:"name:4"` // Outputs are the definition of the execution results of task. Outputs []*Output `hash:"name:5"` // contains filtered or unexported fields }
Task describes a service task.
func (*Task) GetInputParameter ¶ added in v0.3.0
GetInputParameter returns input inputKey parameter of task.
func (*Task) RequireInputs ¶ added in v0.3.0
RequireInputs requires task inputs to be matched with parameter schemas.
func (*Task) ValidateInputs ¶ added in v0.3.0
func (t *Task) ValidateInputs(taskInputs map[string]interface{}) []*ParameterWarning
ValidateInputs produces warnings for task inputs that doesn't satisfy their parameter schemas.
type TaskInputNotFoundError ¶ added in v0.3.0
TaskInputNotFoundError is an error returned when service doesn't contain corresponding input.
func (*TaskInputNotFoundError) Error ¶ added in v0.3.0
func (e *TaskInputNotFoundError) Error() string
type TaskNotFoundError ¶ added in v0.2.0
TaskNotFoundError is an error returned when corresponding task cannot be found in service.
func (*TaskNotFoundError) Error ¶ added in v0.2.0
func (e *TaskNotFoundError) Error() string
type TaskOutputNotFoundError ¶ added in v0.3.0
TaskOutputNotFoundError is an error returned when service doesn't contain corresponding output.
func (*TaskOutputNotFoundError) Error ¶ added in v0.3.0
func (e *TaskOutputNotFoundError) Error() string