rcprotocoltestimpl

package
v0.0.0-...-699f83c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package rcprotocoltestimpl implements the rcprotocoltest component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTransportTests

func RunTransportTests(ctx context.Context, httpClient *api.HTTPClient, runCount uint64)

RunTransportTests performs a pre-flight HTTP check and then runs the echo test over each supported transport protocol (WebSocket, gRPC, TCP).

Each transport test is independent — a failure in one does not prevent the others from running.

Types

type GrpcPingPonger

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

GrpcPingPonger implements PingPonger using the RcEcho gRPC service.

func NewGrpcPingPonger

func NewGrpcPingPonger(ctx context.Context, httpClient *api.HTTPClient, runCount uint64) (*GrpcPingPonger, error)

NewGrpcPingPonger connects to the RC gRPC echo endpoint and returns a GrpcPingPonger ready to exchange frames.

func (*GrpcPingPonger) GracefulClose

func (g *GrpcPingPonger) GracefulClose()

GracefulClose cancels any in-flight RPCs and closes the underlying gRPC connection.

func (*GrpcPingPonger) Recv

func (g *GrpcPingPonger) Recv(_ context.Context) ([]byte, error)

Recv reads the next frame from the server.

func (*GrpcPingPonger) Send

func (g *GrpcPingPonger) Send(_ context.Context, data []byte) error

Send transmits a frame to the server.

type PingPonger

type PingPonger interface {
	Recv(ctx context.Context) ([]byte, error)
	Send(ctx context.Context, data []byte) error
	GracefulClose()
}

PingPonger is a bidirectional echo interface satisfied by each transport protocol (WebSocket, gRPC, TCP).

type Provides

type Provides struct {
	compdef.Out

	Comp rcprotocoltest.Component
}

Provides defines the output of the rcprotocoltest component.

func New

func New(reqs Requires) Provides

New creates a new rcprotocoltest component. If RC is disabled or the echo test is turned off via config, this is a no-op.

type Requires

type Requires struct {
	compdef.In

	Lc  compdef.Lifecycle
	Cfg cfgcomp.Component
}

Requires defines the dependencies for the rcprotocoltest component.

type TCPPingPonger

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

TCPPingPonger performs a ping/pong test by satisfying the PingPonger interface using a raw TCP connection and length-prefixed framing.

Frame structure:

[length prefix][payload ...]

Where `length prefix` is a u16 (2 byte, unsigned) which specifies the length of payload in bytes. Length values are little endian.

func NewTCPPingPonger

func NewTCPPingPonger(ctx context.Context, httpClient *api.HTTPClient) (*TCPPingPonger, error)

NewTCPPingPonger connects to the RC TCP echo endpoint and returns a TCPPingPonger ready to exchange frames.

func (*TCPPingPonger) GracefulClose

func (g *TCPPingPonger) GracefulClose()

GracefulClose closes the underlying TCP connection.

func (*TCPPingPonger) Recv

func (g *TCPPingPonger) Recv(_ context.Context) ([]byte, error)

Recv reads the next length-prefixed frame from the server.

func (*TCPPingPonger) Send

func (g *TCPPingPonger) Send(_ context.Context, data []byte) error

Send transmits a length-prefixed frame to the server.

Jump to

Keyboard shortcuts

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