Documentation ¶
Overview ¶
TODO(ilgooz): remove this file after service package made Newable.
Package service is a generated protocol buffer package.
It is generated from these files:
github.com/mesg-foundation/core/service/service.proto
It has these top-level messages:
Service Event Task Output Parameter Dependency
Index ¶
- func ListRunning() ([]string, error)
- type Dependency
- func (*Dependency) Descriptor() ([]byte, []int)
- func (m *Dependency) GetCommand() string
- func (m *Dependency) GetImage() string
- func (m *Dependency) GetPorts() []string
- func (m *Dependency) GetVolumes() []string
- func (m *Dependency) GetVolumesfrom() []string
- func (*Dependency) ProtoMessage()
- func (m *Dependency) Reset()
- func (m *Dependency) String() string
- type DependencyFromService
- type Event
- func (*Event) Descriptor() ([]byte, []int)
- func (m *Event) GetData() map[string]*Parameter
- func (m *Event) GetDescription() string
- func (m *Event) GetName() string
- func (e *Event) IsValid(data map[string]interface{}) bool
- func (*Event) ProtoMessage()
- func (m *Event) Reset()
- func (m *Event) String() string
- func (e *Event) Validate(data map[string]interface{}) []*ParameterWarning
- type EventNotFoundError
- type InputNotFoundError
- type InvalidEventDataError
- type InvalidOutputDataError
- type InvalidTaskInputError
- type Output
- func (*Output) Descriptor() ([]byte, []int)
- func (m *Output) GetData() map[string]*Parameter
- func (m *Output) GetDescription() string
- func (m *Output) GetName() string
- func (o *Output) IsValid(data map[string]interface{}) bool
- func (*Output) ProtoMessage()
- func (m *Output) Reset()
- func (m *Output) String() string
- func (o *Output) Validate(data map[string]interface{}) []*ParameterWarning
- type OutputNotFoundError
- type Parameter
- func (*Parameter) Descriptor() ([]byte, []int)
- func (m *Parameter) GetDescription() string
- func (m *Parameter) GetName() string
- func (m *Parameter) GetOptional() bool
- func (m *Parameter) GetType() string
- func (*Parameter) ProtoMessage()
- func (m *Parameter) Reset()
- func (m *Parameter) String() string
- func (p *Parameter) Validate(data interface{}) *ParameterWarning
- type ParameterWarning
- type Service
- func (s *Service) Cast(taskKey string, taskData map[string]string) (map[string]interface{}, error)
- func (s *Service) DependenciesFromService() []*DependencyFromService
- func (*Service) Descriptor() ([]byte, []int)
- func (service *Service) EventSubscriptionChannel() string
- func (m *Service) GetConfiguration() *Dependency
- func (m *Service) GetDependencies() map[string]*Dependency
- func (m *Service) GetDescription() string
- func (m *Service) GetEvents() map[string]*Event
- func (m *Service) GetName() string
- func (m *Service) GetRepository() string
- func (m *Service) GetTasks() map[string]*Task
- func (service *Service) Hash() string
- func (service *Service) Logs(onlyForDependency string) ([]io.ReadCloser, error)
- func (*Service) ProtoMessage()
- func (m *Service) Reset()
- func (service *Service) ResultSubscriptionChannel() string
- func (service *Service) Start() (serviceIDs []string, err error)
- func (service *Service) Status() (StatusType, error)
- func (service *Service) Stop() error
- func (service *Service) StopDependencies() error
- func (m *Service) String() string
- func (service *Service) TaskSubscriptionChannel() string
- type StatusType
- type Task
- func (*Task) Descriptor() ([]byte, []int)
- func (m *Task) GetDescription() string
- func (m *Task) GetInputs() map[string]*Parameter
- func (m *Task) GetName() string
- func (m *Task) GetOutputs() map[string]*Output
- func (t *Task) IsValid(data map[string]interface{}) bool
- func (*Task) ProtoMessage()
- func (m *Task) Reset()
- func (m *Task) String() string
- func (t *Task) Validate(data map[string]interface{}) []*ParameterWarning
- type TaskNotFoundError
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 Dependency ¶
type Dependency struct { Image string `protobuf:"bytes,1,opt,name=image" json:"image,omitempty"` Volumes []string `protobuf:"bytes,2,rep,name=volumes" json:"volumes,omitempty"` Volumesfrom []string `protobuf:"bytes,3,rep,name=volumesfrom" json:"volumesfrom,omitempty"` Ports []string `protobuf:"bytes,4,rep,name=ports" json:"ports,omitempty"` Command string `protobuf:"bytes,5,opt,name=command" json:"command,omitempty"` }
A dependency is a configuration of an other Docker container that runs separately from the service.
func (*Dependency) Descriptor ¶
func (*Dependency) Descriptor() ([]byte, []int)
func (*Dependency) GetCommand ¶
func (m *Dependency) GetCommand() string
func (*Dependency) GetImage ¶
func (m *Dependency) GetImage() string
func (*Dependency) GetPorts ¶
func (m *Dependency) GetPorts() []string
func (*Dependency) GetVolumes ¶
func (m *Dependency) GetVolumes() []string
func (*Dependency) GetVolumesfrom ¶
func (m *Dependency) GetVolumesfrom() []string
func (*Dependency) ProtoMessage ¶
func (*Dependency) ProtoMessage()
func (*Dependency) Reset ¶
func (m *Dependency) Reset()
func (*Dependency) String ¶
func (m *Dependency) String() string
type DependencyFromService ¶
type DependencyFromService struct { *Dependency Service *Service Name string }
DependencyFromService represents a Dependency with a pointer to its service and its name.
func (*DependencyFromService) Start ¶
func (dependency *DependencyFromService) Start(networkID string) (containerServiceID string, err error)
Start starts a dependency container.
func (*DependencyFromService) Status ¶
func (dependency *DependencyFromService) Status() (container.StatusType, error)
Status returns StatusType of dependency's container.
func (*DependencyFromService) Stop ¶
func (dependency *DependencyFromService) Stop() error
Stop stops a dependency.
type Event ¶
type Event struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` Data map[string]*Parameter `` /* 128-byte string literal not displayed */ }
Events are emitted by the service whenever the service wants.
func (*Event) Descriptor ¶
func (*Event) GetDescription ¶
func (*Event) IsValid ¶ added in v0.2.0
IsValid returns true if the data are valid for a specific event.
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
func (*Event) Validate ¶ added in v0.2.0
func (e *Event) Validate(data map[string]interface{}) []*ParameterWarning
Validate data for a specific event
type EventNotFoundError ¶ added in v0.2.0
EventNotFoundError is an error when an event cannot be found in a service.
func (*EventNotFoundError) Error ¶ added in v0.2.0
func (e *EventNotFoundError) Error() string
type InputNotFoundError ¶ added in v0.2.0
InputNotFoundError is an error when a service doesn't contains a specific input.
func (*InputNotFoundError) Error ¶ added in v0.2.0
func (e *InputNotFoundError) Error() string
type InvalidEventDataError ¶ added in v0.2.0
InvalidEventDataError is an error when the data of an event are not valid.
func (*InvalidEventDataError) Error ¶ added in v0.2.0
func (e *InvalidEventDataError) Error() string
type InvalidOutputDataError ¶ added in v0.2.0
type InvalidOutputDataError struct { Output *Output TaskKey string OutputKey string OutputData map[string]interface{} }
InvalidOutputDataError is an error when the outputs for one task result are not valid.
func (*InvalidOutputDataError) Error ¶ added in v0.2.0
func (e *InvalidOutputDataError) Error() string
type InvalidTaskInputError ¶ added in v0.2.0
InvalidTaskInputError is an error when the inputs of a task are not valid.
func (*InvalidTaskInputError) Error ¶ added in v0.2.0
func (e *InvalidTaskInputError) Error() string
type Output ¶
type Output struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` Data map[string]*Parameter `` /* 128-byte string literal not displayed */ }
A output is the data a task must return.
func (*Output) Descriptor ¶
func (*Output) GetDescription ¶
func (*Output) IsValid ¶ added in v0.2.0
IsValid returns true if the data are valid for a specific output.
func (*Output) ProtoMessage ¶
func (*Output) ProtoMessage()
func (*Output) Validate ¶ added in v0.2.0
func (o *Output) Validate(data map[string]interface{}) []*ParameterWarning
Validate data for a specific output.
type OutputNotFoundError ¶ added in v0.2.0
OutputNotFoundError is an error when a service doesn't contain a specific output.
func (*OutputNotFoundError) Error ¶ added in v0.2.0
func (e *OutputNotFoundError) Error() string
type Parameter ¶
type Parameter struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` Type string `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"` Optional bool `protobuf:"varint,4,opt,name=optional" json:"optional,omitempty"` }
A parameter is the definition of a specific value.
func (*Parameter) Descriptor ¶
func (*Parameter) GetDescription ¶
func (*Parameter) GetOptional ¶
func (*Parameter) ProtoMessage ¶
func (*Parameter) ProtoMessage()
func (*Parameter) Validate ¶ added in v0.2.0
func (p *Parameter) Validate(data interface{}) *ParameterWarning
Validate returns a warning based on the match of the data given in parameter and the parameter.
type ParameterWarning ¶ added in v0.2.0
type ParameterWarning struct {
// contains filtered or unexported fields
}
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 { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` Tasks map[string]*Task `` /* 130-byte string literal not displayed */ Events map[string]*Event `` /* 132-byte string literal not displayed */ Dependencies map[string]*Dependency `` /* 144-byte string literal not displayed */ Configuration *Dependency `protobuf:"bytes,8,opt,name=configuration" json:"configuration,omitempty"` Repository string `protobuf:"bytes,9,opt,name=repository" json:"repository,omitempty"` }
This is the definition of a MESG Service.
func (*Service) Cast ¶ added in v0.2.0
Cast converts map[string]string to map[string]interface{} based on defined types in the service tasks map.
func (*Service) DependenciesFromService ¶
func (s *Service) DependenciesFromService() []*DependencyFromService
DependenciesFromService returns a slice of DependencyFromService.
func (*Service) Descriptor ¶
func (*Service) EventSubscriptionChannel ¶
EventSubscriptionChannel returns the channel to listen for events from this service.
func (*Service) GetConfiguration ¶
func (m *Service) GetConfiguration() *Dependency
func (*Service) GetDependencies ¶
func (m *Service) GetDependencies() map[string]*Dependency
func (*Service) GetDescription ¶
func (*Service) GetRepository ¶
func (*Service) Logs ¶
func (service *Service) Logs(onlyForDependency string) ([]io.ReadCloser, error)
Logs returns the service's docker service logs. Optionally only shows the logs of a given dependency.
func (*Service) ProtoMessage ¶
func (*Service) ProtoMessage()
func (*Service) ResultSubscriptionChannel ¶
ResultSubscriptionChannel returns the channel to listen for tasks from this service.
func (*Service) Status ¶
func (service *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 ( STOPPED StatusType = 0 PARTIAL StatusType = 1 RUNNING StatusType = 2 )
Possible statuses for service.
type Task ¶
type Task struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` Inputs map[string]*Parameter `` /* 132-byte string literal not displayed */ Outputs map[string]*Output `` /* 134-byte string literal not displayed */ }
A task is a function that requires inputs and returns output.
func (*Task) Descriptor ¶
func (*Task) GetDescription ¶
func (*Task) GetOutputs ¶
func (*Task) IsValid ¶ added in v0.2.0
IsValid returns true if the inputs are valid for a specific task.
func (*Task) ProtoMessage ¶
func (*Task) ProtoMessage()
func (*Task) Validate ¶ added in v0.2.0
func (t *Task) Validate(data map[string]interface{}) []*ParameterWarning
Validate inputs for a specific task.
type TaskNotFoundError ¶ added in v0.2.0
TaskNotFoundError is an error when a task cannot be found in a service.
func (*TaskNotFoundError) Error ¶ added in v0.2.0
func (e *TaskNotFoundError) Error() string