sdk

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

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.

func (*EventFilter) Match

func (f *EventFilter) Match(e *event.Event) bool

Match matches event.

type EventListener

type EventListener struct {
	C chan *event.Event
	// contains filtered or unexported fields
}

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) Close

func (l *EventListener) Close()

Close stops listening for events.

func (*EventListener) Listen

func (l *EventListener) Listen()

Listen listens events that match filter.

type ExecutionFilter

type ExecutionFilter struct {
	Statuses []execution.Status
	TaskKey  string
	Tags     []string
}

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.

func (*ExecutionFilter) Match

func (f *ExecutionFilter) Match(e *execution.Execution) bool

Match matches execution.

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

New creates a new SDK with given options.

func (*SDK) DeleteService

func (sdk *SDK) DeleteService(serviceID string, deleteData bool) error

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) EmitEvent

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

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

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

func (sdk *SDK) GetExecution(hash []byte) (*execution.Execution, error)

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

func (sdk *SDK) GetService(serviceID string) (*service.Service, error)

GetService returns service serviceID.

func (*SDK) ListServices

func (sdk *SDK) ListServices() ([]*service.Service, error)

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

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

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

func (sdk *SDK) StartService(serviceID string) error

StartService starts service serviceID.

func (*SDK) Status

func (sdk *SDK) Status(service *service.Service) (service.StatusType, error)

Status returns the status of a service

func (*SDK) StopService

func (sdk *SDK) StopService(serviceID string) error

StopService stops service serviceID.

func (*SDK) SubmitResult

func (sdk *SDK) SubmitResult(executionHash []byte, outputs []byte, reterr error) error

SubmitResult submits results for executionID.

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
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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