Documentation ¶
Index ¶
- Constants
- Variables
- func MakeRPCCallClient(handler InvokeFunc, coord ServiceCoordinate, v interface{}) error
- type Client
- type Error
- type Healthy
- type InvokeFunc
- type Request
- type Response
- type Server
- type ServiceCoordinate
- func (sc ServiceCoordinate) IsValid() bool
- func (sc ServiceCoordinate) MajorVersion() string
- func (sc ServiceCoordinate) Normalize() ServiceCoordinate
- func (sc ServiceCoordinate) ServicePath() string
- func (sc ServiceCoordinate) ServiceTypeName() string
- func (sc ServiceCoordinate) WithOverride(o ServiceCoordinate) ServiceCoordinate
- type ServiceRegisterConf
Constants ¶
View Source
const ( ErrCodeServiceNotFound = 50001 + iota ErrCodeMethodNotFound )
Variables ¶
View Source
var DefaultGroup = "default"
View Source
var DefaultVersion = "v1.0.0"
Functions ¶
func MakeRPCCallClient ¶
func MakeRPCCallClient(handler InvokeFunc, coord ServiceCoordinate, v interface{}) error
MakeRPCCallClient can make a struct as a rpc client, the method is defined as fields
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(handler InvokeFunc, coordinate ServiceCoordinate) *Client
type Error ¶
type Healthy ¶
type Healthy interface {
Healthy() error
}
Service can implement Healthy interface to provide service health check
type InvokeFunc ¶
type Response ¶
type Response struct { RequestID string // Server use Reply to return the response to client Reply interface{} // Client use GetReply to get target typed replay GetReply func(out interface{}) error Error error Context context.Context }
func ResponseOf ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) MustRegister ¶
func (svr *Server) MustRegister(conf ServiceRegisterConf)
func (*Server) Register ¶
func (svr *Server) Register(conf ServiceRegisterConf) error
func (*Server) ServeRequest ¶
type ServiceCoordinate ¶
type ServiceCoordinate struct { Group string Version string // semver PackageName string ServiceName string }
func GetCoordinate ¶
func GetCoordinate(v interface{}) ServiceCoordinate
func (ServiceCoordinate) IsValid ¶
func (sc ServiceCoordinate) IsValid() bool
func (ServiceCoordinate) MajorVersion ¶
func (sc ServiceCoordinate) MajorVersion() string
func (ServiceCoordinate) Normalize ¶
func (sc ServiceCoordinate) Normalize() ServiceCoordinate
func (ServiceCoordinate) ServicePath ¶
func (sc ServiceCoordinate) ServicePath() string
func (ServiceCoordinate) ServiceTypeName ¶
func (sc ServiceCoordinate) ServiceTypeName() string
func (ServiceCoordinate) WithOverride ¶
func (sc ServiceCoordinate) WithOverride(o ServiceCoordinate) ServiceCoordinate
type ServiceRegisterConf ¶
type ServiceRegisterConf struct { Target interface{} Coordinate ServiceCoordinate }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Consul KV structure services/{group}/{service}/{version} Consul Service Structure {group}-{service.replace('.','-')}-{version}
|
Consul KV structure services/{group}/{service}/{version} Consul Service Structure {group}-{service.replace('.','-')}-{version} |
Click to show internal directories.
Click to hide internal directories.