connwrapper

package
v0.0.0-...-d9c1391 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectConnAndStreamingServer

func ConnectConnAndStreamingServer[RecvT BlobRequest, SendT any](conn net.Conn, strm StreamServer[RecvT, SendT], sendFactory func([]byte) SendT, startWrite <-chan struct{}, options ...WrapperOptions)

Connect a golang net.Conn interface with a grpc bi-directional streaming API. This function blocks until the connection is terminated or errored out. The caller is responsible for making sure that after this function call, with the exception of startWrite, the bi-directional stream only sends and receives bytes, not any other data types. Caller is responsible for closing both conn and strm.

Types

type BlobRequest

type BlobRequest interface {
	GetBlob() []byte
}

type StreamServer

type StreamServer[RecvT BlobRequest, SendT any] interface {
	Recv() (RecvT, error)
	Send(SendT) error
}

type WrapperOptions

type WrapperOptions func(wrapperOptions) wrapperOptions

func WithLogger

func WithLogger(logger *log.Logger) WrapperOptions

Jump to

Keyboard shortcuts

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