rpc

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoMoreClient = errors.New("no more clients")

Functions

func Sort added in v1.6.8

func Sort[C any](ctx context.Context, clients *Clients[C], sortValueFetch SortValueFetcher[C], direction SortDirection) error

func WithClients

func WithClients[C any, V any](clients *Clients[C], f func(context.Context, C) (v V, err error)) (v V, err error)

Types

type Clients

type Clients[C any] struct {
	// contains filtered or unexported fields
}

func NewClients

func NewClients[C any](maxBlockFetchDuration time.Duration, rollingStrategy RollingStrategy[C], logger *zap.Logger) *Clients[C]

func (*Clients[C]) Add

func (c *Clients[C]) Add(client C)

func (*Clients[C]) StartSorting added in v1.6.8

func (c *Clients[C]) StartSorting(ctx context.Context, direction SortDirection, sortValueFetcher SortValueFetcher[C], every time.Duration)

type RollingStrategy added in v1.6.8

type RollingStrategy[C any] interface {
	// contains filtered or unexported methods
}

type RollingStrategyAlwaysUseFirst added in v1.6.8

type RollingStrategyAlwaysUseFirst[C any] struct {
	// contains filtered or unexported fields
}

func NewRollingStrategyAlwaysUseFirst added in v1.6.8

func NewRollingStrategyAlwaysUseFirst[C any]() *RollingStrategyAlwaysUseFirst[C]

type SortDirection added in v1.6.8

type SortDirection int
const (
	SortDirectionAscending SortDirection = iota
	SortDirectionDescending
)

type SortValueFetcher added in v1.6.8

type SortValueFetcher[C any] interface {
	FetchSortValue(ctx context.Context, client C) (sortValue uint64, err error)
}

type StickyRollingStrategy added in v1.6.8

type StickyRollingStrategy[C any] struct {
	// contains filtered or unexported fields
}

func NewStickyRollingStrategy added in v1.6.8

func NewStickyRollingStrategy[C any]() *StickyRollingStrategy[C]

Jump to

Keyboard shortcuts

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