mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
- New zaptransport package: factory, client, server, rpcserver - Internode services (history, matching, worker) use ZAP - Frontend keeps gRPC for Temporal SDK backward compat (for now) - luxfi/zap added as dependency
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination rpc_mock.go
|
|
|
|
package common
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
// RPCFactory creates listeners and connections for inter-service communication,
|
|
// and frontend HTTP clients. Transport is ZAP (luxfi/zap) for internode RPC.
|
|
type RPCFactory interface {
|
|
GetFrontendGRPCServerOptions() ([]grpc.ServerOption, error)
|
|
GetInternodeGRPCServerOptions() ([]grpc.ServerOption, error)
|
|
GetGRPCListener() net.Listener
|
|
CreateRemoteFrontendGRPCConnection(rpcAddress string) grpc.ClientConnInterface
|
|
CreateLocalFrontendGRPCConnection() grpc.ClientConnInterface
|
|
CreateHistoryGRPCConnection(rpcAddress string) grpc.ClientConnInterface
|
|
CreateMatchingGRPCConnection(rpcAddress string) grpc.ClientConnInterface
|
|
CreateLocalFrontendHTTPClient() (*FrontendHTTPClient, error)
|
|
}
|
|
|
|
type FrontendHTTPClient struct {
|
|
http.Client
|
|
// Address is the host:port pair of this HTTP client.
|
|
Address string
|
|
// Scheme is the URL scheme of this HTTP client.
|
|
Scheme string
|
|
}
|
|
|
|
// BaseURL is the scheme and address of this HTTP client.
|
|
func (c *FrontendHTTPClient) BaseURL() string {
|
|
return c.Scheme + "://" + c.Address
|
|
}
|