remote

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDiscarded is returned when there is no slots
	// in process stream
	ErrDiscarded = errors.New("discarded")
)

Functions

func RegisterWorkerServer

func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)

Types

type Client

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

Client connect to a remote grpc endpoint

func NewClient

func NewClient(opts ClientOptions) *Client

NewClient create a new Client with given options

func (*Client) Process

func (c *Client) Process(ctx context.Context, args selina.ProcessArgs) error

Process implements selina.Worker interface

type ClientOptions

type ClientOptions struct {
	Address string
}

ClientOptions customize client

type Error

type Error struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect added in v0.12.0

func (x *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type Message

type Message struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetData

func (x *Message) GetData() []byte

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect added in v0.12.0

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type Server

type Server struct {
	UnimplementedWorkerServer
	// contains filtered or unexported fields
}

Server receive data from a remote endpoint

func NewServer

func NewServer(opts ServerOptions) *Server

NewServer create a new grpc server with given options

func (*Server) Process

func (s *Server) Process(ctx context.Context, args selina.ProcessArgs) (errp error)

Process implements selina.Worker interface

func (*Server) Push

func (s *Server) Push(msg []byte) error

Push put a []byte into process stream, return ErrDiscarded if msg is not send immediately

func (*Server) Send

func (s *Server) Send(ctx context.Context, msg *Message) (*Error, error)

Send implements grpc service

type ServerOptions

type ServerOptions struct {
	Network    string
	Address    string
	BufferSize int
}

ServerOptions customize Server Worker

type UnimplementedWorkerServer

type UnimplementedWorkerServer struct {
}

UnimplementedWorkerServer must be embedded to have forward compatible implementations.

func (UnimplementedWorkerServer) Send

type UnsafeWorkerServer added in v0.12.0

type UnsafeWorkerServer interface {
	// contains filtered or unexported methods
}

UnsafeWorkerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkerServer will result in compilation errors.

type WorkerClient

type WorkerClient interface {
	Send(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Error, error)
}

WorkerClient is the client API for Worker service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewWorkerClient

func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient

type WorkerServer

type WorkerServer interface {
	Send(context.Context, *Message) (*Error, error)
	// contains filtered or unexported methods
}

WorkerServer is the server API for Worker service. All implementations must embed UnimplementedWorkerServer for forward compatibility

Jump to

Keyboard shortcuts

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