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.
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 ¶
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 ¶
func (b *LeaderResolver) Build( target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions, ) (resolver.Resolver, error)
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 ¶
MasterServerList stores a map from server addresses to whether they are the leader.