sockets

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSendClosed = fmt.Errorf("send closed")
View Source
var File_entry_rsocketEntry_sockets_metadata_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CallOption

type CallOption interface {
	grpc.CallOption
	Lava()
}

type CallOptions

type CallOptions struct {
	grpc.EmptyCallOption
	// Headers is a slice of metadata pointers which should all be set when
	// response header metadata is received.
	Headers []*metadata.MD
	// Trailers is a slice of metadata pointers which should all be set when
	// response trailer metadata is received.
	Trailers []*metadata.MD
	// Peer is a slice of peer pointers which should all be set when the
	// remote peer is known.
	Peer []*peer.Peer
	// Creds are per-RPC credentials to use for a call.
	Creds credentials.PerRPCCredentials
	// MaxRecv is the maximum number of bytes to receive for a single message
	// in a call.
	MaxRecv int
	// MaxSend is the maximum number of bytes to send for a single message in
	// a call.
	MaxSend int

	ContentSubtype string

	CompressorType string

	Codec encoding.Codec
}

CallOptions represents the state of in-effect grpc.CallOptions.

func GetCallOptions

func GetCallOptions(opts ...grpc.CallOption) *CallOptions

GetCallOptions converts the given slice of grpc.CallOptions into a CallOptions struct.

func (*CallOptions) Lava

func (co *CallOptions) Lava()

func (*CallOptions) SetHeaders

func (co *CallOptions) SetHeaders(md metadata.MD)

SetHeaders sets all accumulated header addresses to the given metadata. This satisfies grpc.Header call options.

func (*CallOptions) SetPeer

func (co *CallOptions) SetPeer(p *peer.Peer)

SetPeer sets all accumulated peer addresses to the given peer. This satisfies grpc.Peer call options.

func (*CallOptions) SetTrailers

func (co *CallOptions) SetTrailers(md metadata.MD)

SetTrailers sets all accumulated trailer addresses to the given metadata. This satisfies grpc.Trailer call options.

type Client

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

func (*Client) Invoke

func (t *Client) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error

Invoke 请求响应模型实现

func (*Client) NewStream

func (t *Client) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)

NewStream 单项流和双向流实现

type ErrPayload

type ErrPayload struct {
	payload.Payload
	Err chan error
}

func NewErrPayload

func NewErrPayload(data payload.Payload) *ErrPayload

type Metadata

type Metadata struct {
	Version   string            `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	Service   string            `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
	Method    string            `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Trace     string            `protobuf:"bytes,4,opt,name=trace,proto3" json:"trace,omitempty"`
	Address   string            `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"`
	RequestId string            `protobuf:"bytes,6,opt,name=requestId,proto3" json:"requestId,omitempty"`
	Header    map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Metadata) Descriptor deprecated

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

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetAddress

func (x *Metadata) GetAddress() string

func (*Metadata) GetHeader

func (x *Metadata) GetHeader() map[string]string

func (*Metadata) GetMethod

func (x *Metadata) GetMethod() string

func (*Metadata) GetRequestId

func (x *Metadata) GetRequestId() string

func (*Metadata) GetService

func (x *Metadata) GetService() string

func (*Metadata) GetTrace

func (x *Metadata) GetTrace() string

func (*Metadata) GetVersion

func (x *Metadata) GetVersion() string

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

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

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type Request

type Request struct {
	Method      string            `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	ContentType string            `protobuf:"bytes,2,opt,name=contentType,proto3" json:"contentType,omitempty"`
	RequestId   string            `protobuf:"bytes,3,opt,name=requestId,proto3" json:"requestId,omitempty"`
	Headers     map[string]string `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetContentType

func (x *Request) GetContentType() string

func (*Request) GetHeaders

func (x *Request) GetHeaders() map[string]string

func (*Request) GetMethod

func (x *Request) GetMethod() string

func (*Request) GetRequestId

func (x *Request) GetRequestId() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Code int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg  string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// 持续时间(ms)
	Duration int32             `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"`
	Headers  map[string]string `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() int32

func (*Response) GetDuration

func (x *Response) GetDuration() int32

func (*Response) GetHeaders

func (x *Response) GetHeaders() map[string]string

func (*Response) GetMsg

func (x *Response) GetMsg() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type Server

type Server struct {
	ServerStreams bool
	ClientStreams bool
	// contains filtered or unexported fields
}

type StreamHandler

type StreamHandler = grpc.StreamHandler

type UnaryHandler

type UnaryHandler = func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error)

Jump to

Keyboard shortcuts

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