api

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.3.0

type API struct {
	// contains filtered or unexported fields
}

API exposes all functionalities of MESG core.

func New added in v0.3.0

func New(db *database.ServiceDB, options ...Option) (*API, error)

New creates a new API with given options.

func (*API) DeleteService added in v0.3.0

func (a *API) DeleteService(serviceID string) error

DeleteService stops and deletes service serviceID.

func (*API) DeployService added in v0.3.0

func (a *API) DeployService(r io.Reader, options ...DeployServiceOption) (*service.Service,
	*importer.ValidationError, error)

DeployService deploys a service from a gzipped tarball.

func (*API) DeployServiceFromURL added in v0.3.0

func (a *API) DeployServiceFromURL(url string, options ...DeployServiceOption) (*service.Service,
	*importer.ValidationError, error)

DeployServiceFromURL deploys a service living at a Git host. Supported URL types: - https://github.com/mesg-foundation/service-ethereum - https://github.com/mesg-foundation/service-ethereum#branchName

func (*API) EmitEvent added in v0.3.0

func (a *API) EmitEvent(token, eventKey string, eventData map[string]interface{}) error

EmitEvent emits a MESG event eventKey with eventData for service token.

func (*API) ExecuteTask added in v0.3.0

func (a *API) ExecuteTask(serviceID, taskKey string, inputData map[string]interface{},
	tags []string) (executionID string, err error)

ExecuteTask executes a task tasKey with inputData and tags for service serviceID.

func (*API) GetService added in v0.3.0

func (a *API) GetService(serviceID string) (*service.Service, error)

GetService returns service serviceID.

func (*API) ListServices added in v0.3.0

func (a *API) ListServices(filters ...ListServicesFilter) ([]*service.Service, error)

ListServices returns services matches with filters.

func (*API) ListenEvent added in v0.3.0

func (a *API) ListenEvent(serviceID string, filters ...ListenEventFilter) (*EventListener, error)

ListenEvent listens events matches with eventFilter on serviceID.

func (*API) ListenResult added in v0.3.0

func (a *API) ListenResult(serviceID string, filters ...ListenResultFilter) (*ResultListener, error)

ListenResult listens results matches with fiters on serviceID.

func (*API) ListenTask added in v0.3.0

func (a *API) ListenTask(token string) (*TaskListener, error)

ListenTask listens tasks on service token.

func (*API) ServiceLogs added in v0.3.0

func (a *API) ServiceLogs(serviceID string, filters ...ServiceLogsFilter) ([]*service.Log, error)

ServiceLogs gives logs for all dependencies or one when specified with filters of service serviceID.

func (*API) StartService added in v0.3.0

func (a *API) StartService(serviceID string) error

StartService starts service serviceID.

func (*API) StopService added in v0.3.0

func (a *API) StopService(serviceID string) error

StopService stops service serviceID.

func (*API) SubmitResult added in v0.3.0

func (a *API) SubmitResult(executionID, outputKey string, outputData map[string]interface{}) error

SubmitResult submits results for executionID.

type DeployServiceOption added in v0.3.0

type DeployServiceOption func(*serviceDeployer)

DeployServiceOption is a configuration func for deploying services.

func DeployServiceStatusOption added in v0.3.0

func DeployServiceStatusOption(statuses chan DeployStatus) DeployServiceOption

DeployServiceStatusOption receives chan statuses to send deploy statuses.

type DeployStatus added in v0.3.0

type DeployStatus struct {
	Message string
	Type    StatusType
}

DeployStatus represents the deployment status.

type EventListener added in v0.3.0

type EventListener struct {
	// Events receives matching events.
	Events chan *event.Event

	// Err filled when event subscription finished with a failure.
	Err chan error
	// contains filtered or unexported fields
}

EventListener provides functionalities to listen MESG events.

func (*EventListener) Close added in v0.3.0

func (l *EventListener) Close() error

Close stops listening for events.

type ListServicesFilter added in v0.3.0

type ListServicesFilter func(*serviceLister)

ListServicesFilter is a filter func for listing services.

type ListenEventFilter added in v0.3.0

type ListenEventFilter func(*EventListener)

ListenEventFilter is a filter func for filtering events.

func ListenEventKeyFilter added in v0.3.0

func ListenEventKeyFilter(eventKey string) ListenEventFilter

ListenEventKeyFilter returns an eventKey filter.

type ListenResultFilter added in v0.3.0

type ListenResultFilter func(*ResultListener)

ListenResultFilter is a filter func for filtering results.

func ListenResultOutputFilter added in v0.3.0

func ListenResultOutputFilter(outputKey string) ListenResultFilter

ListenResultOutputFilter returns an outputKey filter.

func ListenResultTagFilters added in v0.3.0

func ListenResultTagFilters(tags []string) ListenResultFilter

ListenResultTagFilters returns a tags filter.

func ListenResultTaskFilter added in v0.3.0

func ListenResultTaskFilter(taskKey string) ListenResultFilter

ListenResultTaskFilter returns a taskKey filter.

type MissingExecutionError added in v0.3.0

type MissingExecutionError struct {
	ID string
}

MissingExecutionError is returned when corresponding execution doesn't exists.

func (*MissingExecutionError) Error added in v0.3.0

func (e *MissingExecutionError) Error() string

type NotRunningServiceError added in v0.3.0

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 added in v0.3.0

func (e *NotRunningServiceError) Error() string

type Option added in v0.3.0

type Option func(*API)

Option is a configuration func for MESG.

func ContainerOption added in v0.3.0

func ContainerOption(container container.Container) Option

ContainerOption configures underlying container access API.

type ResultListener added in v0.3.0

type ResultListener struct {
	// Executions receives matching executions for results.
	Executions chan *execution.Execution

	// Err filled when result subscription finished with a failure.
	Err chan error
	// contains filtered or unexported fields
}

ResultListener provides functionalities to listen MESG results.

func (*ResultListener) Close added in v0.3.0

func (l *ResultListener) Close() error

Close stops listening for results.

type ServiceLogsFilter added in v0.3.0

type ServiceLogsFilter func(*logLogger)

ServiceLogsFilter is a filter func for filtering service logs.

func ServiceLogsDependenciesFilter added in v0.3.0

func ServiceLogsDependenciesFilter(dependencies ...string) ServiceLogsFilter

ServiceLogsDependenciesFilter returns a dependency filter.

type StatusType added in v0.3.0

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
)

type TaskListener added in v0.3.0

type TaskListener struct {
	// Executions receives matching executions for tasks.
	Executions chan *execution.Execution

	// Err filled when task subscription finished with a failure.
	Err chan error
	// contains filtered or unexported fields
}

TaskListener provides functionalities to listen MESG tasks.

func (*TaskListener) Close added in v0.3.0

func (l *TaskListener) Close() error

Close stops listening for tasks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL