ping

package
v0.0.0-...-f47c3ff Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PingServer

type PingServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PingServer is used to encapsulate a Ping Server implementation state using connectrpc receivers

func NewPingServer

func NewPingServer(logger slog.Logger) *PingServer

NewPingServer returns a new PingServer instance

func (*PingServer) Count

Count returns a stream of the numbers 1+total -> recieved.addition+total for every received message on the clients stream

func (*PingServer) Generate

Generate returns a stream of the numbers total -> total+addition up to the given limit specified in the request

func (*PingServer) HardFail

HardFail generates an error and returns it to the client when invoked

func (*PingServer) Ping

Ping receives a client ping for the server to determine if it's reachable and will return the sum from previous requests

func (*PingServer) Sum

func (server *PingServer) Sum(ctx context.Context, reqStream *connect.ClientStream[pingv1.SumRequest],
) (resp *connect.Response[pingv1.SumResponse], err error)

Sum returns the sum of the numbers sent on the SumRequest stream and returns a single total that represents the previous sum plus the SumRequest sum

Jump to

Keyboard shortcuts

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