rpc

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operator

type Operator interface {
	// use to client get job
	GetJob(name, region string) (*pb.Job, error)
	// client send execution to server
	SendBackExecution(execution *pb.Execution) error
	// forwarding CRUD operation between servers
	PerformOps(obj interface{}, ops pb.Ops, search *pb.Search) ([]interface{}, int32, error)
	// forwarding run job action between servers
	RunJob(name, region string) (*pb.Execution, error)
}

type RpcClient

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

func NewRpcClient

func NewRpcClient(serveraddr string, serverport int, tlsopt *TlsOpt) (*RpcClient, error)

func (*RpcClient) DoOps

func (c *RpcClient) DoOps(obj interface{}, ops pb.Ops, search *pb.Search) (instances []interface{}, count int32, err error)

func (*RpcClient) ExecDone

func (c *RpcClient) ExecDone(execution *pb.Execution) error

func (*RpcClient) GetJob

func (c *RpcClient) GetJob(name, region string) (*pb.Job, error)

func (*RpcClient) ProxyJobRun

func (c *RpcClient) ProxyJobRun(name, region string) (*pb.Execution, error)

func (*RpcClient) Shutdown

func (c *RpcClient) Shutdown() error

type RpcServer

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

func NewRPCServer

func NewRPCServer(bindIp string, port int, operator Operator, tlsopt *TlsOpt) *RpcServer

func (*RpcServer) DoOps

func (s *RpcServer) DoOps(ctx context.Context, p *pb.Params) (*pb.Result, error)

receive job CRUD ops

func (*RpcServer) ExecDone

func (s *RpcServer) ExecDone(ctx context.Context, execution *pb.Execution) (*google_protobuf.Empty, error)

receive the execution result

func (*RpcServer) GetJob

func (s *RpcServer) GetJob(ctx context.Context, job *pb.Job) (*pb.Job, error)

get job info send to client

func (*RpcServer) ProxyJobRun

func (s *RpcServer) ProxyJobRun(ctx context.Context, in *pb.Job) (*pb.Execution, error)

forwarding run job action

func (*RpcServer) Run

func (s *RpcServer) Run() error

start grpc server process

func (*RpcServer) Shutdown

func (s *RpcServer) Shutdown(timeout time.Duration) error

shutdown grpc server

type TlsOpt

type TlsOpt struct {
	CertFile   string // cert file path
	KeyFile    string // private key file path
	CaFile     string // client use this root ca
	ServerHost string // the server name use to verify the hostname returned by TLS handshake
}

Jump to

Keyboard shortcuts

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