internal

package
v0.0.0-...-1ba95a4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call[ReqT any, RespT any, F func(context.Context, ReqT, ...grpc.CallOption) (RespT, error)] struct {
	// contains filtered or unexported fields
}

Call represents a grpc call.

func NewCall

func NewCall[F func(context.Context, ReqT, ...grpc.CallOption) (RespT, error), ReqT any, RespT any](
	f F, req ReqT, ops ...CallOption,
) *Call[ReqT, RespT, F]

NewCall creates a new Call.

func (*Call[ReqT, RespT, F]) Do

func (c *Call[ReqT, RespT, F]) Do(
	ctx context.Context,
) (RespT, error)

Do actually performs the Call.

type CallOption

type CallOption func(*callerOpts)

CallOption represents an option used to modify the behavior of Call.

func WithForceNoRetry

func WithForceNoRetry() CallOption

WithForceNoRetry forbids a call from being retried. It is typically used if the service provides no idempotency guarantee at all.

type FollowerSorterFn

type FollowerSorterFn = func(address []resolver.Address)

FollowerSorterFn is a function used to customize the order of fail-over in case the servermaster's leader is unreachable.

type LeaderResolver

type LeaderResolver struct {
	*manual.Resolver

	FollowerSorter FollowerSorterFn
	// contains filtered or unexported fields
}

LeaderResolver implements a gRPC resolver that handles the follower logic for servermaster clients.

func NewLeaderResolver

func NewLeaderResolver(
	serverList MasterServerList,
) *LeaderResolver

NewLeaderResolver returns a new LeaderResolver.

func (*LeaderResolver) Build

Build implements resolver.Builder. resolver.Builder is theoretically an abstract factory, but since we are using a one-one relationship between Builder and Resolver, we implement both interfaces on the same struct.

func (*LeaderResolver) Close

func (b *LeaderResolver) Close()

Close closes the LeaderResolver. It implements resolver.Resolver.

func (*LeaderResolver) UpdateServerList

func (b *LeaderResolver) UpdateServerList(serverList MasterServerList)

UpdateServerList should be called by engine's service discovery mechanism to update the serverList in a timely manner.

type MasterServerList

type MasterServerList = map[string]bool

MasterServerList stores a map from server addresses to whether they are the leader.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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