peer

package
v0.0.0-...-461d4b2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionHandlerFn

type ConnectionHandlerFn[T ServiceClient] func(address string, client T) bool

ConnectionHandlerFn returns true if the next connection can be handled. Return false if you do not want to handle the next connection.

type CreateServiceClientFn

type CreateServiceClientFn[T ServiceClient] func(cc grpc.ClientConnInterface) T

type PeerLeaveHandler

type PeerLeaveHandler func(address string)

type PeerPool

type PeerPool[T ServiceClient] interface {
	IsPeer(address string) bool
	Iterate(ctx context.Context, handler ConnectionHandlerFn[T]) error
	OnPeerLeave(handler PeerLeaveHandler)
}

func NewPool

func NewPool[T ServiceClient](
	ctx context.Context,
	conf *config.Config,
	service *client.Service,
	createServiceClient CreateServiceClientFn[T],
	ownIp string,
) PeerPool[T]

type ServiceClient

type ServiceClient any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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