service

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MainServiceKey = "service"

MainServiceKey is key for main service.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// Service's hash.
	Hash github_com_mesg_foundation_engine_hash.Hash `` /* 149-byte string literal not displayed */
	// Service's sid.
	Sid string `protobuf:"bytes,12,opt,name=sid,proto3" json:"sid,omitempty" hash:"name:12" validate:"required,printascii,max=63,domain"`
	// Service's name.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" hash:"name:1" validate:"required,printascii"`
	// Service's description.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" hash:"name:2" validate:"printascii"`
	// Configurations related to the service
	Configuration Service_Configuration `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration" hash:"name:8" validate:"required"`
	// The list of tasks this service can execute.
	Tasks []*Service_Task `protobuf:"bytes,5,rep,name=tasks,proto3" json:"tasks,omitempty" hash:"name:5" validate:"dive,required"`
	// The list of events this service can emit.
	Events []*Service_Event `protobuf:"bytes,6,rep,name=events,proto3" json:"events,omitempty" hash:"name:6" validate:"dive,required"`
	// The container dependencies this service requires.
	Dependencies []*Service_Dependency `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty" hash:"name:7" validate:"dive,required"`
	// Service's repository url.
	Repository string `protobuf:"bytes,9,opt,name=repository,proto3" json:"repository,omitempty" hash:"name:9" validate:"omitempty,uri"`
	// The hash id of service's source code on IPFS.
	Source string `protobuf:"bytes,13,opt,name=source,proto3" json:"source,omitempty" hash:"name:13" validate:"required,printascii"`
	// The address of the service.
	Address              github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 163-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                                      `json:"-"`
	XXX_unrecognized     []byte                                        `json:"-"`
	XXX_sizecache        int32                                         `json:"-"`
}

Service represents the service's type.

func New added in v0.3.0

func New(sid, name, description string, configuration Service_Configuration, tasks []*Service_Task, events []*Service_Event, dependencies []*Service_Dependency, repository, source string) (*Service, error)

New initializes a new Service.

func (*Service) Descriptor

func (*Service) Descriptor() ([]byte, []int)

func (*Service) Equal added in v0.17.0

func (this *Service) Equal(that interface{}) bool

func (*Service) GetDependency added in v0.11.0

func (s *Service) GetDependency(dependencyKey string) (*Service_Dependency, error)

GetDependency returns dependency dependencyKey or a not found error.

func (*Service) GetEvent added in v0.3.0

func (s *Service) GetEvent(eventKey string) (*Service_Event, error)

GetEvent returns event eventKey of service.

func (*Service) GetTask added in v0.3.0

func (s *Service) GetTask(taskKey string) (*Service_Task, error)

GetTask returns task taskKey of service.

func (*Service) ProtoMessage

func (*Service) ProtoMessage()

func (*Service) RequireEventData added in v0.11.0

func (s *Service) RequireEventData(eventKey string, data *types.Struct) error

RequireEventData requires event datas to be matched with parameter schemas.

func (*Service) RequireTaskInputs added in v0.11.0

func (s *Service) RequireTaskInputs(taskKey string, inputs *types.Struct) error

RequireTaskInputs requires task inputs to match with parameter schemas.

func (*Service) RequireTaskOutputs added in v0.11.0

func (s *Service) RequireTaskOutputs(taskKey string, outputs *types.Struct) error

RequireTaskOutputs requires task outputs to match with parameter schemas.

func (*Service) Reset

func (m *Service) Reset()

func (*Service) String

func (m *Service) String() string

func (*Service) Validate added in v0.21.0

func (s *Service) Validate() error

Validate validates if service contains proper data.

func (*Service) XXX_DiscardUnknown added in v0.14.0

func (m *Service) XXX_DiscardUnknown()

func (*Service) XXX_Marshal added in v0.14.0

func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service) XXX_Merge added in v0.14.0

func (m *Service) XXX_Merge(src proto.Message)

func (*Service) XXX_Size added in v0.14.0

func (m *Service) XXX_Size() int

func (*Service) XXX_Unmarshal added in v0.14.0

func (m *Service) XXX_Unmarshal(b []byte) error

type Service_Configuration added in v0.14.0

type Service_Configuration struct {
	// List of volumes.
	Volumes []string `protobuf:"bytes,1,rep,name=volumes,proto3" json:"volumes,omitempty" hash:"name:1" validate:"unique,dive,printascii"`
	// List of volumes mounted from other dependencies.
	VolumesFrom []string `protobuf:"bytes,2,rep,name=volumesFrom,proto3" json:"volumesFrom,omitempty" hash:"name:2" validate:"unique,dive,printascii"`
	// List of ports the container exposes.
	Ports []string `protobuf:"bytes,3,rep,name=ports,proto3" json:"ports,omitempty" hash:"name:3" validate:"unique,dive,portmap"`
	// Args to pass to the container.
	Args []string `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty" hash:"name:5" validate:"dive,printascii"`
	// Command to run the container.
	Command string `protobuf:"bytes,5,opt,name=command,proto3" json:"command,omitempty" hash:"name:4" validate:"printascii"`
	// Default env vars to apply to service's instance on runtime.
	Env                  []string `protobuf:"bytes,6,rep,name=env,proto3" json:"env,omitempty" hash:"name:6" validate:"unique,dive,env"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A configuration is the configuration of the main container of the service's instance.

func (*Service_Configuration) Descriptor added in v0.14.0

func (*Service_Configuration) Descriptor() ([]byte, []int)

func (*Service_Configuration) Equal added in v0.17.0

func (this *Service_Configuration) Equal(that interface{}) bool

func (*Service_Configuration) ProtoMessage added in v0.14.0

func (*Service_Configuration) ProtoMessage()

func (*Service_Configuration) Reset added in v0.14.0

func (m *Service_Configuration) Reset()

func (*Service_Configuration) String added in v0.14.0

func (m *Service_Configuration) String() string

func (*Service_Configuration) XXX_DiscardUnknown added in v0.14.0

func (m *Service_Configuration) XXX_DiscardUnknown()

func (*Service_Configuration) XXX_Marshal added in v0.14.0

func (m *Service_Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Configuration) XXX_Merge added in v0.14.0

func (m *Service_Configuration) XXX_Merge(src proto.Message)

func (*Service_Configuration) XXX_Size added in v0.14.0

func (m *Service_Configuration) XXX_Size() int

func (*Service_Configuration) XXX_Unmarshal added in v0.14.0

func (m *Service_Configuration) XXX_Unmarshal(b []byte) error

type Service_Dependency added in v0.14.0

type Service_Dependency struct {
	// Dependency's key.
	Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty" hash:"name:8" validate:"required,printascii"`
	// Image's name of the container.
	Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty" hash:"name:1" validate:"required,printascii"`
	// List of volumes.
	Volumes []string `protobuf:"bytes,2,rep,name=volumes,proto3" json:"volumes,omitempty" hash:"name:2" validate:"unique,dive,printascii"`
	// List of volumes mounted from other dependencies.
	VolumesFrom []string `protobuf:"bytes,3,rep,name=volumesFrom,proto3" json:"volumesFrom,omitempty" hash:"name:3" validate:"unique,dive,printascii"`
	// List of ports the container exposes.
	Ports []string `protobuf:"bytes,4,rep,name=ports,proto3" json:"ports,omitempty" hash:"name:4" validate:"unique,dive,portmap"`
	// Args to pass to the container.
	Args []string `protobuf:"bytes,6,rep,name=args,proto3" json:"args,omitempty" hash:"name:6" validate:"dive,printascii"`
	// Command to run the container.
	Command string `protobuf:"bytes,5,opt,name=command,proto3" json:"command,omitempty" hash:"name:5" validate:"printascii"`
	// Default env vars to apply to service's instance on runtime.
	Env                  []string `protobuf:"bytes,9,rep,name=env,proto3" json:"env,omitempty" hash:"name:9" validate:"unique,dive,env"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A dependency is a configuration of an other container that runs separately from the service.

func (*Service_Dependency) Descriptor added in v0.14.0

func (*Service_Dependency) Descriptor() ([]byte, []int)

func (*Service_Dependency) Equal added in v0.17.0

func (this *Service_Dependency) Equal(that interface{}) bool

func (*Service_Dependency) ProtoMessage added in v0.14.0

func (*Service_Dependency) ProtoMessage()

func (*Service_Dependency) Reset added in v0.14.0

func (m *Service_Dependency) Reset()

func (*Service_Dependency) String added in v0.14.0

func (m *Service_Dependency) String() string

func (*Service_Dependency) XXX_DiscardUnknown added in v0.14.0

func (m *Service_Dependency) XXX_DiscardUnknown()

func (*Service_Dependency) XXX_Marshal added in v0.14.0

func (m *Service_Dependency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Dependency) XXX_Merge added in v0.14.0

func (m *Service_Dependency) XXX_Merge(src proto.Message)

func (*Service_Dependency) XXX_Size added in v0.14.0

func (m *Service_Dependency) XXX_Size() int

func (*Service_Dependency) XXX_Unmarshal added in v0.14.0

func (m *Service_Dependency) XXX_Unmarshal(b []byte) error

type Service_Event added in v0.14.0

type Service_Event struct {
	// Event's key.
	Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty" hash:"name:4" validate:"required,printascii"`
	// Event's name.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" hash:"name:1" validate:"printascii"`
	// Event's description.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" hash:"name:2" validate:"printascii"`
	// List of data of this event.
	Data                 []*Service_Parameter `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty" hash:"name:3" validate:"dive,required"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

Events are emitted by the service whenever the service wants.

func (*Service_Event) Descriptor added in v0.14.0

func (*Service_Event) Descriptor() ([]byte, []int)

func (*Service_Event) Equal added in v0.17.0

func (this *Service_Event) Equal(that interface{}) bool

func (*Service_Event) ProtoMessage added in v0.14.0

func (*Service_Event) ProtoMessage()

func (*Service_Event) Reset added in v0.14.0

func (m *Service_Event) Reset()

func (*Service_Event) String added in v0.14.0

func (m *Service_Event) String() string

func (*Service_Event) XXX_DiscardUnknown added in v0.14.0

func (m *Service_Event) XXX_DiscardUnknown()

func (*Service_Event) XXX_Marshal added in v0.14.0

func (m *Service_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Event) XXX_Merge added in v0.14.0

func (m *Service_Event) XXX_Merge(src proto.Message)

func (*Service_Event) XXX_Size added in v0.14.0

func (m *Service_Event) XXX_Size() int

func (*Service_Event) XXX_Unmarshal added in v0.14.0

func (m *Service_Event) XXX_Unmarshal(b []byte) error

type Service_Parameter added in v0.14.0

type Service_Parameter struct {
	// Parameter's key.
	Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty" hash:"name:8" validate:"required,printascii"`
	// Parameter's name.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" hash:"name:1" validate:"printascii"`
	// Parameter's description.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" hash:"name:2" validate:"printascii"`
	// Parameter's type: `String`, `Number`, `Boolean`, `Object` or `Any`.
	Type string `` /* 145-byte string literal not displayed */
	// Set the parameter as optional.
	Optional bool `protobuf:"varint,4,opt,name=optional,proto3" json:"optional,omitempty" hash:"name:4"`
	// Mark a parameter as an array of the defined type.
	Repeated bool `protobuf:"varint,9,opt,name=repeated,proto3" json:"repeated,omitempty" hash:"name:9"`
	// Optional object structure type when type is set to `Object`.
	Object               []*Service_Parameter `protobuf:"bytes,10,rep,name=object,proto3" json:"object,omitempty" hash:"name:10" validate:"unique,dive,required"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

Parameter describes the task's inputs, the task's outputs, and the event's data.

func (*Service_Parameter) Descriptor added in v0.14.0

func (*Service_Parameter) Descriptor() ([]byte, []int)

func (*Service_Parameter) Equal added in v0.17.0

func (this *Service_Parameter) Equal(that interface{}) bool

func (*Service_Parameter) ProtoMessage added in v0.14.0

func (*Service_Parameter) ProtoMessage()

func (*Service_Parameter) Reset added in v0.14.0

func (m *Service_Parameter) Reset()

func (*Service_Parameter) String added in v0.14.0

func (m *Service_Parameter) String() string

func (*Service_Parameter) Validate added in v0.14.1

func (p *Service_Parameter) Validate(value *types.Value) error

Validate checks if service parameter hash proper types for arrays and objects.

func (*Service_Parameter) XXX_DiscardUnknown added in v0.14.0

func (m *Service_Parameter) XXX_DiscardUnknown()

func (*Service_Parameter) XXX_Marshal added in v0.14.0

func (m *Service_Parameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Parameter) XXX_Merge added in v0.14.0

func (m *Service_Parameter) XXX_Merge(src proto.Message)

func (*Service_Parameter) XXX_Size added in v0.14.0

func (m *Service_Parameter) XXX_Size() int

func (*Service_Parameter) XXX_Unmarshal added in v0.14.0

func (m *Service_Parameter) XXX_Unmarshal(b []byte) error

type Service_Task added in v0.14.0

type Service_Task struct {
	// Task's key.
	Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty" hash:"name:8" validate:"required,printascii"`
	// Task's name.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" hash:"name:1" validate:"printascii"`
	// Task's description.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" hash:"name:2" validate:"printascii"`
	// List inputs of this task.
	Inputs []*Service_Parameter `protobuf:"bytes,6,rep,name=inputs,proto3" json:"inputs,omitempty" hash:"name:6" validate:"dive,required"`
	// List of tasks outputs.
	Outputs []*Service_Parameter `protobuf:"bytes,7,rep,name=outputs,proto3" json:"outputs,omitempty" hash:"name:7" validate:"dive,required"`
	// price for the task.
	Price                *Service_Task_Price `protobuf:"bytes,9,opt,name=price,proto3" json:"price,omitempty" hash:"name:9" validate:"dive,required"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

Task is a function that requires inputs and returns output.

func (*Service_Task) Descriptor added in v0.14.0

func (*Service_Task) Descriptor() ([]byte, []int)

func (*Service_Task) Equal added in v0.17.0

func (this *Service_Task) Equal(that interface{}) bool

func (*Service_Task) ProtoMessage added in v0.14.0

func (*Service_Task) ProtoMessage()

func (*Service_Task) Reset added in v0.14.0

func (m *Service_Task) Reset()

func (*Service_Task) String added in v0.14.0

func (m *Service_Task) String() string

func (*Service_Task) XXX_DiscardUnknown added in v0.14.0

func (m *Service_Task) XXX_DiscardUnknown()

func (*Service_Task) XXX_Marshal added in v0.14.0

func (m *Service_Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Task) XXX_Merge added in v0.14.0

func (m *Service_Task) XXX_Merge(src proto.Message)

func (*Service_Task) XXX_Size added in v0.14.0

func (m *Service_Task) XXX_Size() int

func (*Service_Task) XXX_Unmarshal added in v0.14.0

func (m *Service_Task) XXX_Unmarshal(b []byte) error

type Service_Task_Price added in v0.26.0

type Service_Task_Price struct {
	PerCall              github_com_cosmos_cosmos_sdk_types.Int `` /* 156-byte string literal not displayed */
	PerSec               github_com_cosmos_cosmos_sdk_types.Int `` /* 154-byte string literal not displayed */
	PerKB                github_com_cosmos_cosmos_sdk_types.Int `` /* 152-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                               `json:"-"`
	XXX_unrecognized     []byte                                 `json:"-"`
	XXX_sizecache        int32                                  `json:"-"`
}

func (*Service_Task_Price) Descriptor added in v0.26.0

func (*Service_Task_Price) Descriptor() ([]byte, []int)

func (*Service_Task_Price) Equal added in v0.26.0

func (this *Service_Task_Price) Equal(that interface{}) bool

func (*Service_Task_Price) ProtoMessage added in v0.26.0

func (*Service_Task_Price) ProtoMessage()

func (*Service_Task_Price) Reset added in v0.26.0

func (m *Service_Task_Price) Reset()

func (*Service_Task_Price) String added in v0.26.0

func (m *Service_Task_Price) String() string

func (*Service_Task_Price) XXX_DiscardUnknown added in v0.26.0

func (m *Service_Task_Price) XXX_DiscardUnknown()

func (*Service_Task_Price) XXX_Marshal added in v0.26.0

func (m *Service_Task_Price) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Service_Task_Price) XXX_Merge added in v0.26.0

func (m *Service_Task_Price) XXX_Merge(src proto.Message)

func (*Service_Task_Price) XXX_Size added in v0.26.0

func (m *Service_Task_Price) XXX_Size() int

func (*Service_Task_Price) XXX_Unmarshal added in v0.26.0

func (m *Service_Task_Price) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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