rpc

package
v0.0.0-...-4919d5a Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rpc implements partition.Network using rpc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialClient

func DialClient(ctx context.Context, addr string) (client, error)

DialClient creates a RPC client

func RegisterRunnerServer

func RegisterRunnerServer(s *grpc.Server, srv RunnerServer)

func RegisterServer

func RegisterServer(ctx context.Context, srv *grpc.Server, addr string, handler Runner) (io.Closer, error)

RegisterServer registers an RPC handler

Types

type RunCloser

type RunCloser interface {
	Run(ctx context.Context, hash uint64, input []byte) ([]byte, error)
	Close() error
}

RunCloser combines Runner and io.Closer

type RunReply

type RunReply struct {
	Response             []byte   `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	Error                string   `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RunReply) Descriptor

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

func (*RunReply) GetError

func (m *RunReply) GetError() string

func (*RunReply) GetResponse

func (m *RunReply) GetResponse() []byte

func (*RunReply) ProtoMessage

func (*RunReply) ProtoMessage()

func (*RunReply) Reset

func (m *RunReply) Reset()

func (*RunReply) String

func (m *RunReply) String() string

func (*RunReply) XXX_DiscardUnknown

func (m *RunReply) XXX_DiscardUnknown()

func (*RunReply) XXX_Marshal

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

func (*RunReply) XXX_Merge

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

func (*RunReply) XXX_Size

func (m *RunReply) XXX_Size() int

func (*RunReply) XXX_Unmarshal

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

type RunRequest

type RunRequest struct {
	Input                []byte   `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"`
	Hash                 uint64   `protobuf:"varint,2,opt,name=hash,proto3" json:"hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RunRequest) Descriptor

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

func (*RunRequest) GetHash

func (m *RunRequest) GetHash() uint64

func (*RunRequest) GetInput

func (m *RunRequest) GetInput() []byte

func (*RunRequest) ProtoMessage

func (*RunRequest) ProtoMessage()

func (*RunRequest) Reset

func (m *RunRequest) Reset()

func (*RunRequest) String

func (m *RunRequest) String() string

func (*RunRequest) XXX_DiscardUnknown

func (m *RunRequest) XXX_DiscardUnknown()

func (*RunRequest) XXX_Marshal

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

func (*RunRequest) XXX_Merge

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

func (*RunRequest) XXX_Size

func (m *RunRequest) XXX_Size() int

func (*RunRequest) XXX_Unmarshal

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

type Runner

type Runner interface {
	Run(ctx context.Context, hash uint64, input []byte) ([]byte, error)
}

Runner executes a single request with the specified hash

type RunnerClient

type RunnerClient interface {
	Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (*RunReply, error)
}

RunnerClient is the client API for Runner service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRunnerClient

func NewRunnerClient(cc *grpc.ClientConn) RunnerClient

type RunnerServer

type RunnerServer interface {
	Run(context.Context, *RunRequest) (*RunReply, error)
}

RunnerServer is the server API for Runner service.

type UnimplementedRunnerServer

type UnimplementedRunnerServer struct {
}

UnimplementedRunnerServer can be embedded to have forward compatible implementations.

func (*UnimplementedRunnerServer) Run

Jump to

Keyboard shortcuts

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