Documentation
¶
Index ¶
- Constants
- func GetClientShardKey(ctx context.Context, message interface{}) string
- func GetShardIndex(hostname string) int
- func UnaryClientInterceptor(dialConfig *DialConfig, dialOpts ...grpc.DialOption) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(addrs []string, id int) grpc.UnaryServerInterceptor
- func UnaryServerInterceptorPreset(servers []*ServerInfo, currentAddr string) grpc.UnaryServerInterceptor
- func UnaryServerInterceptorStatefullset(hostname, port, serviceDomain string, totalShard int) grpc.UnaryServerInterceptor
- type Client
- type DialConfig
- type IClient
- type ServerInfo
Constants ¶
const (
MAX_BACKOFF = 3
)
const (
TransportError = "transport: error while dialing"
)
Variables ¶
This section is empty.
Functions ¶
func GetClientShardKey ¶ added in v0.1.2
func GetShardIndex ¶ added in v0.4.1
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(dialConfig *DialConfig, dialOpts ...grpc.DialOption) grpc.UnaryClientInterceptor
UnaryClientInterceptor is called on every request from a client to a unary server operation, here, we grab the operating system of the client and add it to the metadata within the context of the request so that it can be received by the server
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(addrs []string, id int) grpc.UnaryServerInterceptor
UnaryServerInterceptor is called on every request received from a client to a unary server operation, here, we pull out the client operating system from the metadata, and inspect the context to receive the IP address that the request was received from. We then modify the EdgeLocation type to include this information for every request
func UnaryServerInterceptorPreset ¶ added in v0.5.1
func UnaryServerInterceptorPreset(servers []*ServerInfo, currentAddr string) grpc.UnaryServerInterceptor
UnaryServerInterceptorPreset is called on every request received from a client to a unary server operation, here, we pull out the client operating system from the metadata, and inspect the context to receive the IP address that the request was received from. We then modify the EdgeLocation type to include this information for every request normal case servers like [{host: localhost, port: 8001},{host: localhost, port: 8002}]
func UnaryServerInterceptorStatefullset ¶
func UnaryServerInterceptorStatefullset(hostname, port, serviceDomain string, totalShard int) grpc.UnaryServerInterceptor
UnaryServerInterceptorStatefullset is called on every request received from a client to a unary server operation, here, we pull out the client operating system from the metadata, and inspect the context to receive the IP address that the request was received from. We then modify the EdgeLocation type to include this information for every request in statefull pod-name hostname like: web-0:3456, web-1:3456, ... web-i:3456 serviceDomain like a12.staging.svc.cluster.local
Types ¶
type Client ¶ added in v0.4.1
type Client struct {
// contains filtered or unexported fields
}
func CreateShardClient ¶ added in v0.4.1
func CreateShardClient() *Client
func (*Client) CalcShardIndexByKey ¶ added in v0.4.3
func (*Client) GetShardCount ¶ added in v0.4.1
func (*Client) UnaryClientInterceptor ¶ added in v0.4.1
func (s *Client) UnaryClientInterceptor(dialConfig *DialConfig, dialOpts ...grpc.DialOption) grpc.UnaryClientInterceptor
UnaryClientInterceptor is called on every request from a client to a unary server operation, here, we grab the operating system of the client and add it to the metadata within the context of the request so that it can be received by the server
type DialConfig ¶ added in v0.3.2
type IClient ¶ added in v0.4.2
type IClient interface { UnaryClientInterceptor(dialConfig *DialConfig, dialOpts ...grpc.DialOption) grpc.UnaryClientInterceptor GetShardCount() int GetAddrs() []string CalcShardIndexByKey(key string) int }