vsrpc

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: BSD-2-Clause Imports: 21 Imported by: 0

README

Very Simple RPC

An extensible RPC framework using Protocol Buffers.

Documentation

Index

Constants

View Source
const DefaultUnixMaxPacketSize = (1 << 24)

Variables

View Source
var (
	Frame_Type_name = map[int32]string{
		0: "NO_OP",
		1: "SHUTDOWN",
		2: "GO_AWAY",
		3: "BEGIN",
		4: "REQUEST",
		5: "RESPONSE",
		6: "HALF_CLOSE",
		7: "CANCEL",
		8: "END",
	}
	Frame_Type_value = map[string]int32{
		"NO_OP":      0,
		"SHUTDOWN":   1,
		"GO_AWAY":    2,
		"BEGIN":      3,
		"REQUEST":    4,
		"RESPONSE":   5,
		"HALF_CLOSE": 6,
		"CANCEL":     7,
		"END":        8,
	}
)

Enum value maps for Frame_Type.

View Source
var (
	Status_Code_name = map[int32]string{
		0:  "OK",
		1:  "CANCELLED",
		2:  "UNKNOWN",
		3:  "INVALID_ARGUMENT",
		4:  "DEADLINE_EXCEEDED",
		5:  "NOT_FOUND",
		6:  "ALREADY_EXISTS",
		7:  "PERMISSION_DENIED",
		8:  "RESOURCE_EXHAUSTED",
		9:  "FAILED_PRECONDITION",
		10: "ABORTED",
		11: "OUT_OF_RANGE",
		12: "UNIMPLEMENTED",
		13: "INTERNAL",
		14: "UNAVAILABLE",
		15: "DATA_LOSS",
		16: "UNAUTHENTICATED",
	}
	Status_Code_value = map[string]int32{
		"OK":                  0,
		"CANCELLED":           1,
		"UNKNOWN":             2,
		"INVALID_ARGUMENT":    3,
		"DEADLINE_EXCEEDED":   4,
		"NOT_FOUND":           5,
		"ALREADY_EXISTS":      6,
		"PERMISSION_DENIED":   7,
		"RESOURCE_EXHAUSTED":  8,
		"FAILED_PRECONDITION": 9,
		"ABORTED":             10,
		"OUT_OF_RANGE":        11,
		"UNIMPLEMENTED":       12,
		"INTERNAL":            13,
		"UNAVAILABLE":         14,
		"DATA_LOSS":           15,
		"UNAUTHENTICATED":     16,
	}
)

Enum value maps for Status_Code.

View Source
var ErrCallComplete error = CallCompleteError{}
View Source
var ErrClientClosed = fs.ErrClosed
View Source
var ErrClientClosing error = ClientClosingError{}
View Source
var ErrClosed = fs.ErrClosed
View Source
var ErrConnClosed = fs.ErrClosed
View Source
var ErrEmptyRecv error = EmptyRecvError{}
View Source
var ErrHalfClosed error = HalfClosedError{}
View Source
var ErrServerClosed = fs.ErrClosed
View Source
var ErrServerClosing error = ServerClosingError{}
View Source
var File_vsrpc_frame_proto protoreflect.FileDescriptor
View Source
var File_vsrpc_status_proto protoreflect.FileDescriptor
View Source
var File_vsrpc_vsrpc_test_proto protoreflect.FileDescriptor

Functions

func AppendDetails

func AppendDetails(details []*anypb.Any, err error) []*anypb.Any

func IsRecoverable

func IsRecoverable(err error) bool

func MarshalAny

func MarshalAny(out *anypb.Any, in proto.Message) error

func MessageType

func MessageType(msg proto.Message) string

func ReadFrame

func ReadFrame(ctx context.Context, r PacketReader, frame *Frame) error

func UnmarshalAny

func UnmarshalAny(out proto.Message, in *anypb.Any) error

func UnmarshalFromAny

func UnmarshalFromAny(out proto.Message, in *anypb.Any) error

func UnmarshalFromBytes

func UnmarshalFromBytes(out proto.Message, raw []byte) error

func Watch

func Watch(ctx context.Context, callback func(), body func() error) error

func WithContextCall

func WithContextCall(ctx context.Context, call *Call) context.Context

func WithContextClient

func WithContextClient(ctx context.Context, c *Client) context.Context

func WithContextConn

func WithContextConn(ctx context.Context, conn *Conn) context.Context

func WithContextServer

func WithContextServer(ctx context.Context, s *Server) context.Context

func WriteBegin

func WriteBegin(ctx context.Context, w PacketWriter, id ID, method Method) error

func WriteCancel

func WriteCancel(ctx context.Context, w PacketWriter, id ID) error

func WriteEnd

func WriteEnd(ctx context.Context, w PacketWriter, id ID, status *Status) error

func WriteFrame

func WriteFrame(ctx context.Context, w PacketWriter, frame *Frame) error

func WriteGoAway

func WriteGoAway(ctx context.Context, w PacketWriter) error

func WriteHalfClose

func WriteHalfClose(ctx context.Context, w PacketWriter, id ID) error

func WriteNoOp

func WriteNoOp(ctx context.Context, w PacketWriter) error

func WriteRequest

func WriteRequest(ctx context.Context, w PacketWriter, id ID, payload *anypb.Any) error

func WriteResponse

func WriteResponse(ctx context.Context, w PacketWriter, id ID, payload *anypb.Any) error

func WriteShutdown

func WriteShutdown(ctx context.Context, w PacketWriter) error

Types

type BaseObserver

type BaseObserver struct{}

func (BaseObserver) OnAccept

func (BaseObserver) OnAccept(conn *Conn)

func (BaseObserver) OnAcceptError

func (BaseObserver) OnAcceptError(err error)

func (BaseObserver) OnBegin

func (BaseObserver) OnBegin(call *Call)

func (BaseObserver) OnCancel

func (BaseObserver) OnCancel(call *Call)

func (BaseObserver) OnClose

func (BaseObserver) OnClose(conn *Conn, err error)

func (BaseObserver) OnDial

func (BaseObserver) OnDial(conn *Conn)

func (BaseObserver) OnDialError

func (BaseObserver) OnDialError(err error)

func (BaseObserver) OnEnd

func (BaseObserver) OnEnd(call *Call, status *Status)

func (BaseObserver) OnGlobalClose

func (BaseObserver) OnGlobalClose()

func (BaseObserver) OnGlobalShutdown

func (BaseObserver) OnGlobalShutdown()

func (BaseObserver) OnGoAway

func (BaseObserver) OnGoAway(conn *Conn)

func (BaseObserver) OnHalfClose

func (BaseObserver) OnHalfClose(call *Call)

func (BaseObserver) OnReadError

func (BaseObserver) OnReadError(conn *Conn, err error)

func (BaseObserver) OnRequest

func (BaseObserver) OnRequest(call *Call, payload *anypb.Any)

func (BaseObserver) OnResponse

func (BaseObserver) OnResponse(call *Call, payload *anypb.Any)

func (BaseObserver) OnShutdown

func (BaseObserver) OnShutdown(conn *Conn)

func (BaseObserver) OnWriteError

func (BaseObserver) OnWriteError(conn *Conn, err error)

type BaseStream

type BaseStream interface {
	Call() *Call
	Conn() *Conn
	Context() context.Context
	ID() ID
	Method() Method
	Cancel() error
}

type BiStream

type BiStream[T proto.Message, U proto.Message] interface {
	BaseStream
	SendStream[T]
	RecvStream[U]
}

func NewBiStream

func NewBiStream[T proto.Message, U proto.Message](call *Call) BiStream[T, U]

type Call

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

func ContextCall

func ContextCall(ctx context.Context) *Call

func (*Call) Cancel

func (call *Call) Cancel() error

func (*Call) Close

func (call *Call) Close() error

func (*Call) CloseSend

func (call *Call) CloseSend() error

func (*Call) Conn

func (call *Call) Conn() *Conn

func (*Call) Context

func (call *Call) Context() context.Context

func (*Call) End

func (call *Call) End(status *Status) error

func (*Call) ID

func (call *Call) ID() ID

func (*Call) Method

func (call *Call) Method() Method

func (*Call) Queue

func (call *Call) Queue() *Queue

func (*Call) Role

func (call *Call) Role() Role

func (*Call) Send

func (call *Call) Send(payload *anypb.Any) error

func (*Call) Wait

func (call *Call) Wait() *Status

type CallCompleteError

type CallCompleteError struct{}

func (CallCompleteError) Error

func (err CallCompleteError) Error() string

type CallIdError

type CallIdError struct {
	Type Frame_Type
	ID   ID
}

func (CallIdError) Error

func (err CallIdError) Error() string

type Client

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

func ContextClient

func ContextClient(ctx context.Context) *Client

func NewClient

func NewClient(pd PacketDialer, options ...Option) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Dial

func (c *Client) Dial(ctx context.Context, addr net.Addr, options ...Option) (*Conn, error)

func (*Client) DialExisting

func (c *Client) DialExisting(pc PacketConn, options ...Option) (*Conn, error)

func (*Client) Dialer

func (c *Client) Dialer() PacketDialer

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) error

type ClientClosingError

type ClientClosingError struct{}

func (ClientClosingError) Error

func (err ClientClosingError) Error() string

type Conn

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

func ContextConn

func ContextConn(ctx context.Context) *Conn

func (*Conn) Begin

func (conn *Conn) Begin(ctx context.Context, method Method, options ...Option) (*Call, error)

func (*Conn) Client

func (conn *Conn) Client() *Client

func (*Conn) Close

func (conn *Conn) Close() error

func (*Conn) LocalAddr

func (conn *Conn) LocalAddr() net.Addr

func (*Conn) PacketConn

func (conn *Conn) PacketConn() PacketConn

func (*Conn) RemoteAddr

func (conn *Conn) RemoteAddr() net.Addr

func (*Conn) Role

func (conn *Conn) Role() Role

func (*Conn) Server

func (conn *Conn) Server() *Server

func (*Conn) Shutdown

func (conn *Conn) Shutdown(ctx context.Context) error

type DuplicateCallError

type DuplicateCallError struct {
	ID  ID
	Old Method
	New Method
}

func (DuplicateCallError) Error

func (err DuplicateCallError) Error() string

type EmptyRecvError

type EmptyRecvError struct{}

func (EmptyRecvError) Error

func (EmptyRecvError) Error() string

type Frame

type Frame struct {
	Type     Frame_Type             `protobuf:"varint,1,opt,name=type,proto3,enum=vsrpc.Frame_Type" json:"type,omitempty"`
	CallId   uint32                 `protobuf:"varint,2,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"`
	Method   string                 `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Deadline *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deadline,proto3" json:"deadline,omitempty"`
	Payload  *anypb.Any             `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
	Status   *Status                `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*Frame) Descriptor deprecated

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

Deprecated: Use Frame.ProtoReflect.Descriptor instead.

func (*Frame) GetCallId

func (x *Frame) GetCallId() uint32

func (*Frame) GetDeadline

func (x *Frame) GetDeadline() *timestamppb.Timestamp

func (*Frame) GetMethod

func (x *Frame) GetMethod() string

func (*Frame) GetPayload

func (x *Frame) GetPayload() *anypb.Any

func (*Frame) GetStatus

func (x *Frame) GetStatus() *Status

func (*Frame) GetType

func (x *Frame) GetType() Frame_Type

func (*Frame) ProtoMessage

func (*Frame) ProtoMessage()

func (*Frame) ProtoReflect

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

func (*Frame) Reset

func (x *Frame) Reset()

func (*Frame) String

func (x *Frame) String() string

type FrameTypeError

type FrameTypeError struct {
	Type Frame_Type
}

func (FrameTypeError) Error

func (err FrameTypeError) Error() string

type Frame_Type

type Frame_Type int32
const (
	// NO_OP denotes a frame that does nothing.
	//
	// A NO_OP frame is *not* a ping and does *not* solicit a response.  Both
	// clients and servers should ignore any NO_OP frames they receive, and
	// neither clients nor servers should send NO_OP frames under normal
	// circumstances.
	//
	// Direction: any
	// Required fields: type
	// Optional fields: NONE
	Frame_NO_OP Frame_Type = 0
	// SHUTDOWN tells the server that no more BEGIN frames will be sent.
	//
	// Direction: client to server
	// Required fields: type
	// Optional fields: NONE
	Frame_SHUTDOWN Frame_Type = 1
	// GO_AWAY tells the client that future BEGIN frames will not be honored,
	// because the server is shutting down the connection.
	//
	// The server may start aborting in-progress RPC calls if they do not
	// complete quickly enough, or it may close the connection without warning,
	// with or without sending a GO_AWAY frame.  The client must treat
	// abandoned RPC calls as having failed with status code ABORTED.
	//
	// Direction: server to client
	// Required fields: type
	// Optional fields: NONE
	Frame_GO_AWAY Frame_Type = 2
	// BEGIN creates a new RPC call.
	//
	// Direction: client to server
	// Required fields: type, call_id, method
	// Optional fields: deadline
	Frame_BEGIN Frame_Type = 3
	// REQUEST sends a request body for an RPC call.
	//
	// Direction: client to server
	// Required fields: type, call_id, payload
	// Optional fields: NONE
	Frame_REQUEST Frame_Type = 4
	// RESPONSE sends a response body for an RPC call.
	//
	// It is valid for the server to send RESPONSE frames before the client has
	// sent HALF_CLOSE; this is how bidirectional streaming works.
	//
	// Direction: server to client
	// Required fields: type, call_id, payload
	// Optional fields: NONE
	Frame_RESPONSE Frame_Type = 5
	// HALF_CLOSE tells the server that no more REQUEST frames will be sent for
	// this RPC call.
	//
	// Direction: client to server
	// Required fields: type, call_id
	// Optional fields: NONE
	Frame_HALF_CLOSE Frame_Type = 6
	// CANCEL asks the server to cancel the in-progress RPC call.
	//
	// The RPC call remains outstanding until the server sends a END frame.
	// Status code CANCELLED indicates that the cancellation was accepted.
	//
	// Direction: client to server
	// Required fields: type, call_id
	// Optional fields: NONE
	Frame_CANCEL Frame_Type = 7
	// END reports the final status of the RPC call.
	//
	// If the client continues to send frames relating to this call, the server
	// must ignore them; they are NOT a protocol violation.
	//
	// Direction: server to client
	// Required fields: type, call_id, status
	// Optional fields: NONE
	Frame_END Frame_Type = 8
)

func (Frame_Type) Descriptor

func (Frame_Type) Descriptor() protoreflect.EnumDescriptor

func (Frame_Type) Enum

func (x Frame_Type) Enum() *Frame_Type

func (Frame_Type) EnumDescriptor deprecated

func (Frame_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Frame_Type.Descriptor instead.

func (Frame_Type) Number

func (x Frame_Type) Number() protoreflect.EnumNumber

func (Frame_Type) String

func (x Frame_Type) String() string

func (Frame_Type) Type

type FuncObserver

type FuncObserver struct {
	Accept         func(conn *Conn)
	AcceptError    func(err error)
	Dial           func(conn *Conn)
	DialError      func(err error)
	GlobalShutdown func()
	GlobalClose    func()

	Begin     func(call *Call)
	Request   func(call *Call, payload *anypb.Any)
	Response  func(call *Call, payload *anypb.Any)
	HalfClose func(call *Call)
	Cancel    func(call *Call)
	End       func(call *Call, status *Status)

	Shutdown func(conn *Conn)
	GoAway   func(conn *Conn)

	ReadError  func(conn *Conn, err error)
	WriteError func(conn *Conn, err error)
	Close      func(conn *Conn, err error)
}

func (*FuncObserver) OnAccept

func (o *FuncObserver) OnAccept(conn *Conn)

func (*FuncObserver) OnAcceptError

func (o *FuncObserver) OnAcceptError(err error)

func (*FuncObserver) OnBegin

func (o *FuncObserver) OnBegin(call *Call)

func (*FuncObserver) OnCancel

func (o *FuncObserver) OnCancel(call *Call)

func (*FuncObserver) OnClose

func (o *FuncObserver) OnClose(conn *Conn, err error)

func (*FuncObserver) OnDial

func (o *FuncObserver) OnDial(conn *Conn)

func (*FuncObserver) OnDialError

func (o *FuncObserver) OnDialError(err error)

func (*FuncObserver) OnEnd

func (o *FuncObserver) OnEnd(call *Call, status *Status)

func (*FuncObserver) OnGlobalClose

func (o *FuncObserver) OnGlobalClose()

func (*FuncObserver) OnGlobalShutdown

func (o *FuncObserver) OnGlobalShutdown()

func (*FuncObserver) OnGoAway

func (o *FuncObserver) OnGoAway(conn *Conn)

func (*FuncObserver) OnHalfClose

func (o *FuncObserver) OnHalfClose(call *Call)

func (*FuncObserver) OnReadError

func (o *FuncObserver) OnReadError(conn *Conn, err error)

func (*FuncObserver) OnRequest

func (o *FuncObserver) OnRequest(call *Call, payload *anypb.Any)

func (*FuncObserver) OnResponse

func (o *FuncObserver) OnResponse(call *Call, payload *anypb.Any)

func (*FuncObserver) OnShutdown

func (o *FuncObserver) OnShutdown(conn *Conn)

func (*FuncObserver) OnWriteError

func (o *FuncObserver) OnWriteError(conn *Conn, err error)

type HalfClosedError

type HalfClosedError struct{}

func (HalfClosedError) Error

func (err HalfClosedError) Error() string

type Handler

type Handler interface {
	Handle(*Call) error
}

type HandlerFunc

type HandlerFunc func(*Call) error

func (HandlerFunc) Handle

func (fn HandlerFunc) Handle(call *Call) error

type HandlerMux

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

func (*HandlerMux) Add

func (mux *HandlerMux) Add(h Handler, methods ...Method)

func (*HandlerMux) AddFunc

func (mux *HandlerMux) AddFunc(fn func(*Call) error, methods ...Method)

func (*HandlerMux) Find

func (mux *HandlerMux) Find(method Method, inexact bool) Handler

func (*HandlerMux) Handle

func (mux *HandlerMux) Handle(call *Call) error

func (*HandlerMux) Remove

func (mux *HandlerMux) Remove(methods ...Method)

func (*HandlerMux) Reset

func (mux *HandlerMux) Reset()

type ID

type ID uint32

type InappropriateError

type InappropriateError struct {
	Op   string
	Role Role
}

func (InappropriateError) Error

func (err InappropriateError) Error() string

type Method

type Method string

type NoSuchMethodError

type NoSuchMethodError struct {
	Method Method
}

func (NoSuchMethodError) As

func (err NoSuchMethodError) As(out any) bool

func (NoSuchMethodError) Error

func (err NoSuchMethodError) Error() string

type Observer

type Observer interface {
	OnAccept(conn *Conn)
	OnAcceptError(err error)
	OnDial(conn *Conn)
	OnDialError(err error)
	OnGlobalShutdown()
	OnGlobalClose()

	OnBegin(call *Call)
	OnRequest(call *Call, payload *anypb.Any)
	OnResponse(call *Call, payload *anypb.Any)
	OnHalfClose(call *Call)
	OnCancel(call *Call)
	OnEnd(call *Call, status *Status)

	OnShutdown(conn *Conn)
	OnGoAway(conn *Conn)

	OnReadError(conn *Conn, err error)
	OnWriteError(conn *Conn, err error)
	OnClose(conn *Conn, err error)
}

type Option

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

func ConcatOptions

func ConcatOptions(a []Option, b ...Option) []Option

func WithObserver

func WithObserver(o Observer) Option

type PacketConn

type PacketConn interface {
	io.Closer
	PacketReader
	PacketWriter

	LocalAddr() net.Addr

	RemoteAddr() net.Addr
}

type PacketDialer

type PacketDialer interface {
	DialPacket(ctx context.Context, addr net.Addr) (PacketConn, error)
	ListenPacket(ctx context.Context, addr net.Addr) (PacketListener, error)
}
var DefaultPacketDialer PacketDialer

type PacketListener

type PacketListener interface {
	io.Closer

	AcceptPacket(ctx context.Context) (PacketConn, error)

	Addr() net.Addr
}

type PacketReader

type PacketReader interface {
	ReadPacket(ctx context.Context) ([]byte, func(), error)
}

type PacketWriter

type PacketWriter interface {
	WritePacket(ctx context.Context, p []byte) error
}

type PanicError

type PanicError struct {
	Err error
}

func (PanicError) Error

func (err PanicError) Error() string

func (PanicError) Unwrap

func (err PanicError) Unwrap() error

type ProtocolViolationError

type ProtocolViolationError struct {
	Err error
}

func (ProtocolViolationError) Error

func (err ProtocolViolationError) Error() string

func (ProtocolViolationError) IsRecoverable

func (err ProtocolViolationError) IsRecoverable() bool

func (ProtocolViolationError) Unwrap

func (err ProtocolViolationError) Unwrap() error

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Done

func (q *Queue) Done()

func (*Queue) Push

func (q *Queue) Push(value *anypb.Any) bool

func (*Queue) Recv

func (q *Queue) Recv(blocking bool) (*anypb.Any, bool, bool)

type RecoverableError

type RecoverableError struct {
	Err error
}

func (RecoverableError) Error

func (err RecoverableError) Error() string

func (RecoverableError) IsRecoverable

func (err RecoverableError) IsRecoverable() bool

func (RecoverableError) Unwrap

func (err RecoverableError) Unwrap() error

type RecvStream

type RecvStream[T proto.Message] interface {
	BaseStream
	Recv(blocking bool, out T) (ok bool, done bool, err error)
}

func NewRecvStream

func NewRecvStream[T proto.Message](call *Call) RecvStream[T]

type Role

type Role byte
const (
	UnknownRole Role = iota
	ClientRole
	ServerRole
)

func (Role) GoString

func (enum Role) GoString() string

func (Role) MarshalText

func (enum Role) MarshalText() ([]byte, error)

func (Role) String

func (enum Role) String() string

type SendStream

type SendStream[T proto.Message] interface {
	BaseStream
	Send(in T) error
	CloseSend() error
}

func NewSendStream

func NewSendStream[T proto.Message](call *Call) SendStream[T]

type Server

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

func ContextServer

func ContextServer(ctx context.Context) *Server

func NewServer

func NewServer(pl PacketListener, h Handler, options ...Option) *Server

func (*Server) Addr

func (s *Server) Addr() net.Addr

func (*Server) Close

func (s *Server) Close() error

func (*Server) Handler

func (s *Server) Handler() Handler

func (*Server) Listener

func (s *Server) Listener() PacketListener

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type ServerClosingError

type ServerClosingError struct{}

func (ServerClosingError) Error

func (err ServerClosingError) Error() string

type State

type State uint32
const (
	StateRunning State = iota
	StateShuttingDown
	StateGoingAway
	StateClosed
)

func (State) GoString

func (enum State) GoString() string

func (State) MarshalText

func (enum State) MarshalText() ([]byte, error)

func (State) String

func (enum State) String() string

type Status

type Status struct {
	Code     Status_Code  `protobuf:"varint,1,opt,name=code,proto3,enum=vsrpc.Status_Code" json:"code,omitempty"`
	Text     string       `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	Details  []*anypb.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"`
	CanRetry bool         `protobuf:"varint,4,opt,name=can_retry,json=canRetry,proto3" json:"can_retry,omitempty"`
	// contains filtered or unexported fields
}

func Abort

func Abort(err error) *Status

func StatusFromError

func StatusFromError(err error) *Status

func (*Status) AsError

func (status *Status) AsError() error

func (*Status) CopyFrom

func (status *Status) CopyFrom(src *Status)

func (*Status) Descriptor deprecated

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) FromError

func (status *Status) FromError(err error)

func (*Status) GetCanRetry

func (x *Status) GetCanRetry() bool

func (*Status) GetCode

func (x *Status) GetCode() Status_Code

func (*Status) GetDetails

func (x *Status) GetDetails() []*anypb.Any

func (*Status) GetText

func (x *Status) GetText() string

func (*Status) IsOK

func (status *Status) IsOK() bool

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

type StatusError

type StatusError struct {
	Status *Status
}

func (StatusError) Error

func (err StatusError) Error() string

type Status_Code

type Status_Code int32
const (
	Status_OK                  Status_Code = 0
	Status_CANCELLED           Status_Code = 1
	Status_UNKNOWN             Status_Code = 2
	Status_INVALID_ARGUMENT    Status_Code = 3
	Status_DEADLINE_EXCEEDED   Status_Code = 4
	Status_NOT_FOUND           Status_Code = 5
	Status_ALREADY_EXISTS      Status_Code = 6
	Status_PERMISSION_DENIED   Status_Code = 7
	Status_RESOURCE_EXHAUSTED  Status_Code = 8
	Status_FAILED_PRECONDITION Status_Code = 9
	Status_ABORTED             Status_Code = 10
	Status_OUT_OF_RANGE        Status_Code = 11
	Status_UNIMPLEMENTED       Status_Code = 12
	Status_INTERNAL            Status_Code = 13
	Status_UNAVAILABLE         Status_Code = 14
	Status_DATA_LOSS           Status_Code = 15
	Status_UNAUTHENTICATED     Status_Code = 16
)

func (Status_Code) Descriptor

func (Status_Code) Enum

func (x Status_Code) Enum() *Status_Code

func (Status_Code) EnumDescriptor deprecated

func (Status_Code) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status_Code.Descriptor instead.

func (Status_Code) Number

func (x Status_Code) Number() protoreflect.EnumNumber

func (Status_Code) String

func (x Status_Code) String() string

func (Status_Code) Type

type SumRequest

type SumRequest struct {
	Input []int32 `protobuf:"varint,1,rep,packed,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

func (*SumRequest) Descriptor deprecated

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

Deprecated: Use SumRequest.ProtoReflect.Descriptor instead.

func (*SumRequest) GetInput

func (x *SumRequest) GetInput() []int32

func (*SumRequest) ProtoMessage

func (*SumRequest) ProtoMessage()

func (*SumRequest) ProtoReflect

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

func (*SumRequest) Reset

func (x *SumRequest) Reset()

func (*SumRequest) String

func (x *SumRequest) String() string

type SumResponse

type SumResponse struct {
	Output int32 `protobuf:"varint,1,opt,name=output,proto3" json:"output,omitempty"`
	// contains filtered or unexported fields
}

func (*SumResponse) Descriptor deprecated

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

Deprecated: Use SumResponse.ProtoReflect.Descriptor instead.

func (*SumResponse) GetOutput

func (x *SumResponse) GetOutput() int32

func (*SumResponse) ProtoMessage

func (*SumResponse) ProtoMessage()

func (*SumResponse) ProtoReflect

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

func (*SumResponse) Reset

func (x *SumResponse) Reset()

func (*SumResponse) String

func (x *SumResponse) String() string

type TypeError

type TypeError struct {
	Actual protoreflect.FullName
	Expect protoreflect.FullName
}

func (TypeError) As

func (err TypeError) As(out any) bool

func (TypeError) Error

func (err TypeError) Error() string

type UnixPacketConn

type UnixPacketConn struct {
	Conn                net.Conn
	Now                 func() time.Time
	MaxPacketSize       uint
	ReadTimeout         time.Duration
	WriteTimeout        time.Duration
	ReadTimeoutEnabled  bool
	WriteTimeoutEnabled bool
}

func (*UnixPacketConn) Close

func (pc *UnixPacketConn) Close() error

func (*UnixPacketConn) LocalAddr

func (pc *UnixPacketConn) LocalAddr() net.Addr

func (*UnixPacketConn) ReadPacket

func (pc *UnixPacketConn) ReadPacket(ctx context.Context) (packet []byte, dispose func(), err error)

func (*UnixPacketConn) RemoteAddr

func (pc *UnixPacketConn) RemoteAddr() net.Addr

func (*UnixPacketConn) WritePacket

func (pc *UnixPacketConn) WritePacket(ctx context.Context, packet []byte) error

type UnixPacketDialer

type UnixPacketDialer struct {
	Dialer               *net.Dialer
	ListenConfig         *net.ListenConfig
	Now                  func() time.Time
	MaxPacketSize        uint
	AcceptTimeout        time.Duration
	ReadTimeout          time.Duration
	WriteTimeout         time.Duration
	AcceptTimeoutEnabled bool
	ReadTimeoutEnabled   bool
	WriteTimeoutEnabled  bool
	UnlinkOnClose        bool
}

func (*UnixPacketDialer) DialPacket

func (pd *UnixPacketDialer) DialPacket(ctx context.Context, addr net.Addr) (PacketConn, error)

func (*UnixPacketDialer) ListenPacket

func (pd *UnixPacketDialer) ListenPacket(ctx context.Context, addr net.Addr) (PacketListener, error)

type UnixPacketListener

type UnixPacketListener struct {
	Listener             net.Listener
	Now                  func() time.Time
	MaxPacketSize        uint
	AcceptTimeout        time.Duration
	ReadTimeout          time.Duration
	WriteTimeout         time.Duration
	AcceptTimeoutEnabled bool
	ReadTimeoutEnabled   bool
	WriteTimeoutEnabled  bool
}

func (*UnixPacketListener) AcceptPacket

func (pl *UnixPacketListener) AcceptPacket(ctx context.Context) (pc PacketConn, err error)

func (*UnixPacketListener) Addr

func (pl *UnixPacketListener) Addr() net.Addr

func (*UnixPacketListener) Close

func (pl *UnixPacketListener) Close() error

type UnmarshalError

type UnmarshalError struct {
	Type string
	Err  error
}

func (UnmarshalError) As

func (err UnmarshalError) As(out any) bool

func (UnmarshalError) Error

func (err UnmarshalError) Error() string

func (UnmarshalError) Unwrap

func (err UnmarshalError) Unwrap() error

type UnrecoverableError

type UnrecoverableError struct {
	Err error
}

func (UnrecoverableError) Error

func (err UnrecoverableError) Error() string

func (UnrecoverableError) IsRecoverable

func (err UnrecoverableError) IsRecoverable() bool

func (UnrecoverableError) Unwrap

func (err UnrecoverableError) Unwrap() error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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