Documentation ¶
Index ¶
- type DeployServiceOption
- type DeployStatus
- type EventFilter
- type EventListener
- type ExecutionFilter
- type ExecutionListener
- type NotRunningServiceError
- type SDK
- func (sdk *SDK) DeleteService(serviceID string, deleteData bool) error
- func (sdk *SDK) DeployService(r io.Reader, env map[string]string, options ...DeployServiceOption) (*service.Service, *importer.ValidationError, error)
- func (sdk *SDK) DeployServiceFromURL(url string, env map[string]string, options ...DeployServiceOption) (*service.Service, *importer.ValidationError, error)
- func (sdk *SDK) EmitEvent(token, eventKey string, eventData map[string]interface{}) error
- func (sdk *SDK) ExecuteTask(serviceID, taskKey string, inputData map[string]interface{}, tags []string) (executionHash []byte, err error)
- func (sdk *SDK) GetExecution(hash []byte) (*execution.Execution, error)
- func (sdk *SDK) GetExecutionStream(f *ExecutionFilter) *ExecutionListener
- func (sdk *SDK) GetService(serviceID string) (*service.Service, error)
- func (sdk *SDK) ListServices() ([]*service.Service, error)
- func (sdk *SDK) ListenEvent(service string, f *EventFilter) (*EventListener, error)
- func (sdk *SDK) ListenExecution(service string, f *ExecutionFilter) (*ExecutionListener, error)
- func (sdk *SDK) ServiceLogs(serviceID string, filters ...ServiceLogsFilter) ([]*service.Log, error)
- func (sdk *SDK) StartService(serviceID string) error
- func (sdk *SDK) Status(service *service.Service) (service.StatusType, error)
- func (sdk *SDK) StopService(serviceID string) error
- func (sdk *SDK) SubmitResult(executionHash []byte, outputs []byte, reterr error) error
- type ServiceLogsFilter
- type StatusType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeployServiceOption ¶
type DeployServiceOption func(*serviceDeployer)
DeployServiceOption is a configuration func for deploying services.
func DeployServiceStatusOption ¶
func DeployServiceStatusOption(statuses chan DeployStatus) DeployServiceOption
DeployServiceStatusOption receives chan statuses to send deploy statuses.
type DeployStatus ¶
type DeployStatus struct { Message string Type StatusType }
DeployStatus represents the deployment status.
type EventFilter ¶
type EventFilter struct {
Key string
}
EventFilter store fileds for matching events.
func (*EventFilter) HasKey ¶
func (f *EventFilter) HasKey() bool
HasKey returns true if key is set to specified value.
type EventListener ¶
EventListener provides functionalities to listen MESG events.
func NewEventListener ¶
func NewEventListener(ps *pubsub.PubSub, topic string, f *EventFilter) *EventListener
NewEventListener creates a new EventListener with given sdk and filters.
func (*EventListener) Listen ¶
func (l *EventListener) Listen()
Listen listens events that match filter.
type ExecutionFilter ¶
ExecutionFilter store fileds for matching executions.
func (*ExecutionFilter) HasTaskKey ¶
func (f *ExecutionFilter) HasTaskKey() bool
HasTaskKey returns true if task key is set to specified value.
type ExecutionListener ¶
type ExecutionListener struct { // Channel receives matching executions for tasks. C chan *execution.Execution // contains filtered or unexported fields }
ExecutionListener provides functionalities to listen MESG tasks.
func NewExecutionListener ¶
func NewExecutionListener(ps *pubsub.PubSub, topic string, f *ExecutionFilter) *ExecutionListener
NewExecutionListener creates a new ExecutionListener with given sdk.
func (*ExecutionListener) Close ¶
func (l *ExecutionListener) Close()
Close stops listening for events.
func (*ExecutionListener) Listen ¶
func (l *ExecutionListener) Listen()
Listen listens executions that match filter.
type NotRunningServiceError ¶
type NotRunningServiceError struct {
ServiceID string
}
NotRunningServiceError is an error returned when the service is not running that a task needed to be executed on.
func (*NotRunningServiceError) Error ¶
func (e *NotRunningServiceError) Error() string
type SDK ¶
type SDK struct { Service *servicesdk.Service // contains filtered or unexported fields }
SDK exposes all functionalities of MESG core.
func New ¶
func New(m manager.Manager, c container.Container, db database.ServiceDB, execDB database.ExecutionDB) *SDK
New creates a new SDK with given options.
func (*SDK) DeleteService ¶
DeleteService stops and deletes service serviceID. when deleteData is enabled, any persistent data that belongs to the service and to its dependencies also will be deleted.
func (*SDK) DeployService ¶
func (sdk *SDK) DeployService(r io.Reader, env map[string]string, options ...DeployServiceOption) (*service.Service, *importer.ValidationError, error)
DeployService deploys a service from a gzipped tarball.
func (*SDK) DeployServiceFromURL ¶
func (sdk *SDK) DeployServiceFromURL(url string, env map[string]string, options ...DeployServiceOption) (*service.Service, *importer.ValidationError, error)
DeployServiceFromURL deploys a service from a Git or tarball url. individual branch deployments are supported through Git, see: - https://github.com/mesg-foundation/service-ethereum - https://github.com/mesg-foundation/service-ethereum#branchName
func (*SDK) ExecuteTask ¶
func (sdk *SDK) ExecuteTask(serviceID, taskKey string, inputData map[string]interface{}, tags []string) (executionHash []byte, err error)
ExecuteTask executes a task tasKey with inputData and tags for service serviceID.
func (*SDK) GetExecution ¶
GetExecution returns execution that matches given hash.
func (*SDK) GetExecutionStream ¶
func (sdk *SDK) GetExecutionStream(f *ExecutionFilter) *ExecutionListener
GetExecutionStream returns execution that matches given hash.
func (*SDK) GetService ¶
GetService returns service serviceID.
func (*SDK) ListServices ¶
ListServices returns all services.
func (*SDK) ListenEvent ¶
func (sdk *SDK) ListenEvent(service string, f *EventFilter) (*EventListener, error)
ListenEvent listens events matches with eventFilter on serviceID.
func (*SDK) ListenExecution ¶
func (sdk *SDK) ListenExecution(service string, f *ExecutionFilter) (*ExecutionListener, error)
ListenExecution listens executions on service.
func (*SDK) ServiceLogs ¶
ServiceLogs provides logs for dependencies of service serviceID that matches with filters. when no dependency filters are set, all the dependencies' logs will be provided.
func (*SDK) StartService ¶
StartService starts service serviceID.
func (*SDK) StopService ¶
StopService stops service serviceID.
type ServiceLogsFilter ¶
type ServiceLogsFilter func(*serviceLogFilters)
ServiceLogsFilter is a filter func for filtering service logs.
func ServiceLogsDependenciesFilter ¶
func ServiceLogsDependenciesFilter(dependencies ...string) ServiceLogsFilter
ServiceLogsDependenciesFilter returns a dependency filter.
type StatusType ¶
type StatusType int
StatusType indicates the type of status message.
const ( // Running indicates that status message belongs to a continuous state. Running StatusType // DonePositive indicates that status message belongs to a positive noncontinuous state. DonePositive // DoneNegative indicates that status message belongs to a negative noncontinuous state. DoneNegative )