client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// CloseConn closes the gRPC client connection.
	CloseConn(ctx context.Context) error
	// IsReady checks if the udsource connection is ready.
	IsReady(ctx context.Context, in *emptypb.Empty) (bool, error)
	// ReadFn reads messages from the udsource.
	ReadFn(ctx context.Context, req *sourcepb.ReadRequest, datumCh chan<- *sourcepb.ReadResponse) error
	// AckFn acknowledges messages from the udsource.
	AckFn(ctx context.Context, req *sourcepb.AckRequest) (*sourcepb.AckResponse, error)
	// PendingFn returns the number of pending messages from the udsource.
	PendingFn(ctx context.Context, req *emptypb.Empty) (*sourcepb.PendingResponse, error)
}

Client contains methods to call a gRPC client.

func New

func New(inputOptions ...Option) (Client, error)

New creates a new client object.

func NewFromClient

func NewFromClient(c sourcepb.SourceClient) (Client, error)

NewFromClient creates a new client object from the grpc client. This is used for testing.

type Option

type Option func(*options)

Option is the interface to apply options.

func WithMaxMessageSize

func WithMaxMessageSize(size int) Option

WithMaxMessageSize sets the max message size to the given size.

func WithServerInfoFilePath

func WithServerInfoFilePath(f string) Option

WithServerInfoFilePath start the client with the given server info file path. This is mainly used for testing purpose.

func WithServerInfoReadinessTimeout

func WithServerInfoReadinessTimeout(t time.Duration) Option

WithServerInfoReadinessTimeout sets the server info readiness timeout to the given timeout.

func WithSockAddr

func WithSockAddr(addr string) Option

WithSockAddr start the client with the given sock addr. This is mainly used for testing purpose.

Jump to

Keyboard shortcuts

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