conn

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: BSD-3-Clause Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	Conn_Read_FullMethodName             = "/net.conn.Conn/Read"
	Conn_Write_FullMethodName            = "/net.conn.Conn/Write"
	Conn_Close_FullMethodName            = "/net.conn.Conn/Close"
	Conn_SetDeadline_FullMethodName      = "/net.conn.Conn/SetDeadline"
	Conn_SetReadDeadline_FullMethodName  = "/net.conn.Conn/SetReadDeadline"
	Conn_SetWriteDeadline_FullMethodName = "/net.conn.Conn/SetWriteDeadline"
)

Variables

View Source
var (
	ErrorCode_name = map[int32]string{
		0: "ERROR_CODE_UNSPECIFIED",
		1: "ERROR_CODE_EOF",
		2: "ERROR_CODE_OS_ERR_DEADLINE_EXCEEDED",
	}
	ErrorCode_value = map[string]int32{
		"ERROR_CODE_UNSPECIFIED":              0,
		"ERROR_CODE_EOF":                      1,
		"ERROR_CODE_OS_ERR_DEADLINE_EXCEEDED": 2,
	}
)

Enum value maps for ErrorCode.

View Source
var Conn_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "net.conn.Conn",
	HandlerType: (*ConnServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Read",
			Handler:    _Conn_Read_Handler,
		},
		{
			MethodName: "Write",
			Handler:    _Conn_Write_Handler,
		},
		{
			MethodName: "Close",
			Handler:    _Conn_Close_Handler,
		},
		{
			MethodName: "SetDeadline",
			Handler:    _Conn_SetDeadline_Handler,
		},
		{
			MethodName: "SetReadDeadline",
			Handler:    _Conn_SetReadDeadline_Handler,
		},
		{
			MethodName: "SetWriteDeadline",
			Handler:    _Conn_SetWriteDeadline_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "net/conn/conn.proto",
}

Conn_ServiceDesc is the grpc.ServiceDesc for Conn service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_net_conn_conn_proto protoreflect.FileDescriptor

Functions

func RegisterConnServer

func RegisterConnServer(s grpc.ServiceRegistrar, srv ConnServer)

Types

type ConnClient

type ConnClient interface {
	// Read reads data from the connection.
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	// Write writes data to the connection.
	Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error)
	// Close closes the connection.
	Close(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetDeadline sets the read and write deadlines associated
	// with the connection.
	SetDeadline(ctx context.Context, in *SetDeadlineRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetReadDeadline sets the deadline for future Read calls
	// and any currently-blocked Read call.
	SetReadDeadline(ctx context.Context, in *SetDeadlineRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetWriteDeadline sets the deadline for future Write calls
	// and any currently-blocked Write call.
	SetWriteDeadline(ctx context.Context, in *SetDeadlineRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

ConnClient is the client API for Conn service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

Conn is a net.Conn see: https://pkg.go.dev/net#Conn

func NewConnClient

func NewConnClient(cc grpc.ClientConnInterface) ConnClient

type ConnServer

type ConnServer interface {
	// Read reads data from the connection.
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	// Write writes data to the connection.
	Write(context.Context, *WriteRequest) (*WriteResponse, error)
	// Close closes the connection.
	Close(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// SetDeadline sets the read and write deadlines associated
	// with the connection.
	SetDeadline(context.Context, *SetDeadlineRequest) (*emptypb.Empty, error)
	// SetReadDeadline sets the deadline for future Read calls
	// and any currently-blocked Read call.
	SetReadDeadline(context.Context, *SetDeadlineRequest) (*emptypb.Empty, error)
	// SetWriteDeadline sets the deadline for future Write calls
	// and any currently-blocked Write call.
	SetWriteDeadline(context.Context, *SetDeadlineRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

ConnServer is the server API for Conn service. All implementations must embed UnimplementedConnServer for forward compatibility.

Conn is a net.Conn see: https://pkg.go.dev/net#Conn

type Error added in v1.13.3

type Error struct {
	ErrorCode ErrorCode `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,enum=net.conn.ErrorCode" json:"error_code,omitempty"`
	Message   string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated added in v1.13.3

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetErrorCode added in v1.13.3

func (x *Error) GetErrorCode() ErrorCode

func (*Error) GetMessage added in v1.13.3

func (x *Error) GetMessage() string

func (*Error) ProtoMessage added in v1.13.3

func (*Error) ProtoMessage()

func (*Error) ProtoReflect added in v1.13.3

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

func (*Error) Reset added in v1.13.3

func (x *Error) Reset()

func (*Error) String added in v1.13.3

func (x *Error) String() string

type ErrorCode added in v1.13.3

type ErrorCode int32

ErrorCode provides information for special sentinel error types

const (
	ErrorCode_ERROR_CODE_UNSPECIFIED              ErrorCode = 0
	ErrorCode_ERROR_CODE_EOF                      ErrorCode = 1
	ErrorCode_ERROR_CODE_OS_ERR_DEADLINE_EXCEEDED ErrorCode = 2
)

func (ErrorCode) Descriptor added in v1.13.3

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum added in v1.13.3

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated added in v1.13.3

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

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number added in v1.13.3

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String added in v1.13.3

func (x ErrorCode) String() string

func (ErrorCode) Type added in v1.13.3

type ReadRequest

type ReadRequest struct {

	// length of the request in bytes
	Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetLength

func (x *ReadRequest) GetLength() int32

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

type ReadResponse struct {

	// read is the payload in bytes
	Read []byte `protobuf:"bytes,1,opt,name=read,proto3" json:"read,omitempty"`
	// error is an error message
	Error *Error `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetError

func (x *ReadResponse) GetError() *Error

func (*ReadResponse) GetRead

func (x *ReadResponse) GetRead() []byte

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

type SetDeadlineRequest

type SetDeadlineRequest struct {

	// time represents an instant in time in bytes
	Time []byte `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
	// contains filtered or unexported fields
}

func (*SetDeadlineRequest) Descriptor deprecated

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

Deprecated: Use SetDeadlineRequest.ProtoReflect.Descriptor instead.

func (*SetDeadlineRequest) GetTime

func (x *SetDeadlineRequest) GetTime() []byte

func (*SetDeadlineRequest) ProtoMessage

func (*SetDeadlineRequest) ProtoMessage()

func (*SetDeadlineRequest) ProtoReflect

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

func (*SetDeadlineRequest) Reset

func (x *SetDeadlineRequest) Reset()

func (*SetDeadlineRequest) String

func (x *SetDeadlineRequest) String() string

type UnimplementedConnServer

type UnimplementedConnServer struct{}

UnimplementedConnServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedConnServer) Close

func (UnimplementedConnServer) Read

func (UnimplementedConnServer) SetDeadline

func (UnimplementedConnServer) SetReadDeadline

func (UnimplementedConnServer) SetWriteDeadline

func (UnimplementedConnServer) Write

type UnsafeConnServer

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

UnsafeConnServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ConnServer will result in compilation errors.

type WriteRequest

type WriteRequest struct {

	// payload is the write request in bytes
	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*WriteRequest) Descriptor deprecated

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

Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead.

func (*WriteRequest) GetPayload

func (x *WriteRequest) GetPayload() []byte

func (*WriteRequest) ProtoMessage

func (*WriteRequest) ProtoMessage()

func (*WriteRequest) ProtoReflect

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

func (*WriteRequest) Reset

func (x *WriteRequest) Reset()

func (*WriteRequest) String

func (x *WriteRequest) String() string

type WriteResponse

type WriteResponse struct {

	// length of the response in bytes
	Length int32 `protobuf:"varint,1,opt,name=length,proto3" json:"length,omitempty"`
	// error is an error message
	Error *string `protobuf:"bytes,2,opt,name=error,proto3,oneof" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*WriteResponse) Descriptor deprecated

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

Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead.

func (*WriteResponse) GetError

func (x *WriteResponse) GetError() string

func (*WriteResponse) GetLength

func (x *WriteResponse) GetLength() int32

func (*WriteResponse) ProtoMessage

func (*WriteResponse) ProtoMessage()

func (*WriteResponse) ProtoReflect

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

func (*WriteResponse) Reset

func (x *WriteResponse) Reset()

func (*WriteResponse) String

func (x *WriteResponse) String() string

Jump to

Keyboard shortcuts

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