service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package service is a generated protocol buffer package.

It is generated from these files:

github.com/mesg-foundation/core/api/service/api.proto

It has these top-level messages:

EmitEventRequest
EmitEventReply
ListenTaskRequest
TaskData
SubmitResultRequest
SubmitResultReply

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterServiceServer

func RegisterServiceServer(s *grpc.Server, srv ServiceServer)

Types

type EmitEventReply

type EmitEventReply struct {
}

Reply of `EmitEvent` API doesn't contain any data.

func (*EmitEventReply) Descriptor

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

func (*EmitEventReply) ProtoMessage

func (*EmitEventReply) ProtoMessage()

func (*EmitEventReply) Reset

func (m *EmitEventReply) Reset()

func (*EmitEventReply) String

func (m *EmitEventReply) String() string

type EmitEventRequest

type EmitEventRequest struct {
	Token     string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
	EventKey  string `protobuf:"bytes,2,opt,name=eventKey" json:"eventKey,omitempty"`
	EventData string `protobuf:"bytes,3,opt,name=eventData" json:"eventData,omitempty"`
}

The request's data for the `EmitEvent` API.

**Example:** ```json

{
  "token":     "__SERVICE_TOKEN_FROM_ENV__",
  "eventKey":  "__EVENT_KEY__",
  "eventData": "{\"foo\":\"hello\",\"bar\":false}"
}

```

func (*EmitEventRequest) Descriptor

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

func (*EmitEventRequest) GetEventData

func (m *EmitEventRequest) GetEventData() string

func (*EmitEventRequest) GetEventKey

func (m *EmitEventRequest) GetEventKey() string

func (*EmitEventRequest) GetToken

func (m *EmitEventRequest) GetToken() string

func (*EmitEventRequest) ProtoMessage

func (*EmitEventRequest) ProtoMessage()

func (*EmitEventRequest) Reset

func (m *EmitEventRequest) Reset()

func (*EmitEventRequest) String

func (m *EmitEventRequest) String() string

type ListenTaskRequest

type ListenTaskRequest struct {
	Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
}

The request's data for the `ListenTask` stream API.

**Example:** ```json

{
  "token": "__SERVICE_TOKEN_FROM_ENV__"
}

```

func (*ListenTaskRequest) Descriptor

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

func (*ListenTaskRequest) GetToken

func (m *ListenTaskRequest) GetToken() string

func (*ListenTaskRequest) ProtoMessage

func (*ListenTaskRequest) ProtoMessage()

func (*ListenTaskRequest) Reset

func (m *ListenTaskRequest) Reset()

func (*ListenTaskRequest) String

func (m *ListenTaskRequest) String() string

type MissingExecutionError added in v0.2.0

type MissingExecutionError struct {
	ID string
}

MissingExecutionError is an error when an execution doesn't exists.

func (*MissingExecutionError) Error added in v0.2.0

func (e *MissingExecutionError) Error() string

type Server

type Server struct{}

Server binds all api functions.

func (*Server) EmitEvent

func (s *Server) EmitEvent(context context.Context, request *EmitEventRequest) (*EmitEventReply, error)

EmitEvent permits to send and event to anyone who subscribed to it.

func (*Server) ListenTask

func (s *Server) ListenTask(request *ListenTaskRequest, stream Service_ListenTaskServer) error

ListenTask creates a stream that will send data for every task to execute.

func (*Server) SubmitResult

func (s *Server) SubmitResult(context context.Context, request *SubmitResultRequest) (*SubmitResultReply, error)

SubmitResult subbmits results of an execution.

type ServiceClient

type ServiceClient interface {
	// Emit an event to [Core](../guide/start-here/core.md).
	// The event and its data must be defined in the [service's definition file](../guide/service/service-file.md).
	EmitEvent(ctx context.Context, in *EmitEventRequest, opts ...grpc.CallOption) (*EmitEventReply, error)
	// Subscribe to the stream of tasks to execute.
	// Every task received must be executed and its result must be submitted using the `SubmitResult` API.
	ListenTask(ctx context.Context, in *ListenTaskRequest, opts ...grpc.CallOption) (Service_ListenTaskClient, error)
	// Submit the result of a task's execution to [Core](../guide/start-here/core.md).
	// The result must be defined as a task's output in the [service's definition file](../guide/service/service-file.md).
	SubmitResult(ctx context.Context, in *SubmitResultRequest, opts ...grpc.CallOption) (*SubmitResultReply, error)
}

func NewServiceClient

func NewServiceClient(cc *grpc.ClientConn) ServiceClient

type ServiceServer

type ServiceServer interface {
	// Emit an event to [Core](../guide/start-here/core.md).
	// The event and its data must be defined in the [service's definition file](../guide/service/service-file.md).
	EmitEvent(context.Context, *EmitEventRequest) (*EmitEventReply, error)
	// Subscribe to the stream of tasks to execute.
	// Every task received must be executed and its result must be submitted using the `SubmitResult` API.
	ListenTask(*ListenTaskRequest, Service_ListenTaskServer) error
	// Submit the result of a task's execution to [Core](../guide/start-here/core.md).
	// The result must be defined as a task's output in the [service's definition file](../guide/service/service-file.md).
	SubmitResult(context.Context, *SubmitResultRequest) (*SubmitResultReply, error)
}

type Service_ListenTaskClient

type Service_ListenTaskClient interface {
	Recv() (*TaskData, error)
	grpc.ClientStream
}

type Service_ListenTaskServer

type Service_ListenTaskServer interface {
	Send(*TaskData) error
	grpc.ServerStream
}

type SubmitResultReply

type SubmitResultReply struct {
}

Reply of `SubmitResult` API doesn't contain any data.

func (*SubmitResultReply) Descriptor

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

func (*SubmitResultReply) ProtoMessage

func (*SubmitResultReply) ProtoMessage()

func (*SubmitResultReply) Reset

func (m *SubmitResultReply) Reset()

func (*SubmitResultReply) String

func (m *SubmitResultReply) String() string

type SubmitResultRequest

type SubmitResultRequest struct {
	ExecutionID string `protobuf:"bytes,1,opt,name=executionID" json:"executionID,omitempty"`
	OutputKey   string `protobuf:"bytes,2,opt,name=outputKey" json:"outputKey,omitempty"`
	OutputData  string `protobuf:"bytes,3,opt,name=outputData" json:"outputData,omitempty"`
}

The request's data for the `SubmitResult` API. The data must contain the `executionID` of the executed task received from the stream of [`ListenTask` API](#listentask).

**Example:** ```json

{
  "executionID": "__EXECUTION_ID__",
  "outputKey":   "__OUTPUT_KEY__",
  "outputData":  "{\"foo\":\"super result\",\"bar\":true}"
}

```

func (*SubmitResultRequest) Descriptor

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

func (*SubmitResultRequest) GetExecutionID

func (m *SubmitResultRequest) GetExecutionID() string

func (*SubmitResultRequest) GetOutputData

func (m *SubmitResultRequest) GetOutputData() string

func (*SubmitResultRequest) GetOutputKey

func (m *SubmitResultRequest) GetOutputKey() string

func (*SubmitResultRequest) ProtoMessage

func (*SubmitResultRequest) ProtoMessage()

func (*SubmitResultRequest) Reset

func (m *SubmitResultRequest) Reset()

func (*SubmitResultRequest) String

func (m *SubmitResultRequest) String() string

type TaskData

type TaskData struct {
	ExecutionID string `protobuf:"bytes,1,opt,name=executionID" json:"executionID,omitempty"`
	TaskKey     string `protobuf:"bytes,2,opt,name=taskKey" json:"taskKey,omitempty"`
	InputData   string `protobuf:"bytes,3,opt,name=inputData" json:"inputData,omitempty"`
}

The data received from the stream of the `ListenTask` API. The data will be received over time as long as the stream is open. The `executionID` value must be kept and sent with the result when calling the [`SubmitResult` API](#submitresult).

**Example:** ```json

{
  "executionID": "__EXECUTION_ID__",
  "taskKey":     "__TASK_KEY__",
  "inputData":   "{\"inputX\":\"Hello world!\",\"inputY\":true}"
}

```

func (*TaskData) Descriptor

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

func (*TaskData) GetExecutionID

func (m *TaskData) GetExecutionID() string

func (*TaskData) GetInputData

func (m *TaskData) GetInputData() string

func (*TaskData) GetTaskKey

func (m *TaskData) GetTaskKey() string

func (*TaskData) ProtoMessage

func (*TaskData) ProtoMessage()

func (*TaskData) Reset

func (m *TaskData) Reset()

func (*TaskData) String

func (m *TaskData) String() string

Jump to

Keyboard shortcuts

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