rrpc

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 15 Imported by: 1

README

rsocket-rpc-go

logo

Travis (.org) GoDoc Go Report Card License GitHub Release

NOTICE

It is still under development. DO NOT USE IT IN A PRODUCTION ENVIRONMENT!!!

Install

  1. Install Protocol Buffers v3. Please see https://github.com/protocolbuffers/protobuf.
  2. We offer a protoc-gen-go with RSocket RPC support and it's 100% compatible with official tools. Please install by command below:
$ go get -u github.com/rsocket/rsocket-rpc-go/protoc-gen-go

Generate Codes

If you are familiar with grpc, just replace the grpc with rrpc:

$ protoc --go_out=plugins=rrpc:./ping-pong ./ping-pong.proto

NOTICE: you can find some sample codes in examples

Documentation

Index

Constants

View Source
const Version = uint16(1)

Variables

This section is empty.

Functions

func MarshallTracing

func MarshallTracing(carrier map[string]string) (b []byte, err error)

func NewRequestPayload

func NewRequestPayload(srv string, method string, d []byte, tracing []byte, metadata []byte) (req payload.Payload, err error)

func UnmarshallTracingCarrier

func UnmarshallTracingCarrier(tracing []byte) (map[string]string, error)

Types

type CallOption

type CallOption func(*callOption)

func WithMetadata

func WithMetadata(metadata []byte) CallOption

func WithTracing

func WithTracing(tracing []byte) CallOption

type ClientConn

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

ClientConn struct

func NewClientConn

func NewClientConn(c rsocket.RSocket, m MeterRegistry, t Tracer) *ClientConn

NewClientConn creates new client

func (*ClientConn) InvokeChannel

func (p *ClientConn) InvokeChannel(
	ctx context.Context,
	srv string,
	method string,
	datachan chan *[]byte,
	err chan error,
	opts ...CallOption) (<-chan payload.Payload, <-chan error)

func (*ClientConn) InvokeRequestResponse

func (p *ClientConn) InvokeRequestResponse(
	ctx context.Context,
	srv string,
	method string,
	data *[]byte,
	opts ...CallOption,
) (<-chan payload.Payload, <-chan error)

InvokeRequestResponse invoke request response

func (*ClientConn) InvokeRequestStream

func (p *ClientConn) InvokeRequestStream(
	ctx context.Context,
	srv string,
	method string,
	data *[]byte,
	opts ...CallOption,
) (<-chan payload.Payload, <-chan error)

InvokeRequestStream invoke request stream

type Metadata

type Metadata []byte

func EncodeMetadata

func EncodeMetadata(service string, method string, tracing []byte, metadata []byte) (m Metadata, err error)

func (Metadata) Metadata

func (p Metadata) Metadata() []byte

func (Metadata) Method

func (p Metadata) Method() string

func (Metadata) Service

func (p Metadata) Service() string

func (Metadata) String

func (p Metadata) String() string

func (Metadata) Tracing

func (p Metadata) Tracing() []byte

func (Metadata) Version

func (p Metadata) Version() uint16

type MeterRegistry

type MeterRegistry interface {
}

type MethodDesc

type MethodDesc struct {
	Name    string
	Handler methodHandler
}

type RequestHandler

type RequestHandler struct {
	rsocket.RSocket
	// contains filtered or unexported fields
}

func NewRequestHandler

func NewRequestHandler() *RequestHandler

func (*RequestHandler) FireAndForget

func (r *RequestHandler) FireAndForget(msg payload.Payload)

FireAndForget is a single one-way message.

func (*RequestHandler) MetadataPush

func (r *RequestHandler) MetadataPush(msg payload.Payload)

MetadataPush sends asynchronous Metadata frame.

func (*RequestHandler) Register

func (r *RequestHandler) Register(rsocket RrpcRSocket) error

func (*RequestHandler) RequestChannel

func (r *RequestHandler) RequestChannel(msgs rx.Publisher) flux.Flux

func (*RequestHandler) RequestResponse

func (r *RequestHandler) RequestResponse(msg payload.Payload) mono.Mono

RequestResponse request single response.

func (*RequestHandler) RequestStream

func (r *RequestHandler) RequestStream(msg payload.Payload) flux.Flux

RequestStream request a completable stream.

type RequestHandlingRSocket

type RequestHandlingRSocket interface {
	rsocket.RSocket
	Register(rsocket RrpcRSocket) error
}

type RrpcRSocket

type RrpcRSocket interface {
	rsocket.RSocket
	Name() string
}

type ServiceDesc

type ServiceDesc struct {
	Name        string
	HandlerType interface{}
	Methods     []MethodDesc

	Metadata interface{}
}

type SpanContext

type SpanContext opentracing.SpanContext

func UnmarshallTracing

func UnmarshallTracing(tracer Tracer, tracing []byte) (SpanContext, error)

type Tracer

type Tracer opentracing.Tracer

Directories

Path Synopsis
protoc-gen-go is a plugin for the Google protocol buffer compiler to generate Go code.
protoc-gen-go is a plugin for the Google protocol buffer compiler to generate Go code.

Jump to

Keyboard shortcuts

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