Documentation ¶
Index ¶
Constants ¶
View Source
const ( HeaderNode = "X-Node-Id" // 限定 node ContentType = "Content-Type" Accept = "Accept" )
Variables ¶
View Source
var ( // ErrIPNotFound no IP address found, and explicit IP not provided. ErrIPNotFound = errors.New("no IP address found, and explicit IP not provided") ErrServiceNotFound = errors.New("service not found") ErrWatcherStopped = errors.New("watcher stopped") ErrSelectServiceNotFound = errors.New("not found") ErrNoneServiceAvailable = errors.New("none available") )
View Source
var (
DefaultCodecs = map[string]string{
"text/html": "application/grpc+bytes",
"text/plain": "application/grpc+bytes",
"application/grpc+json": "application/grpc+json",
"application/grpc+proto": "application/grpc+proto",
"application/grpc+bytes": "application/grpc+bytes",
"application/json": "application/grpc+json",
"application/grpc": "application/grpc+proto",
"application/protobuf": "application/grpc+proto",
"application/octet-stream": "application/grpc+bytes",
}
)
Functions ¶
func MatchCodec ¶
Types ¶
type ComponentBase ¶
type ComponentBase struct { }
func (*ComponentBase) AfterInit ¶
func (*ComponentBase) AfterInit()
func (*ComponentBase) BeforeShutdown ¶
func (*ComponentBase) BeforeShutdown()
func (*ComponentBase) Init ¶
func (*ComponentBase) Init()
func (*ComponentBase) Internal ¶
func (*ComponentBase) Internal() bool
func (*ComponentBase) Shutdown ¶
func (*ComponentBase) Shutdown()
type Request ¶
type Request interface { // The service to call Service() string // The action to take Method() string // The endpoint to invoke Endpoint() string // The content type Protocols() *Protocols // The unencoded request body Body() interface{} // service version fileter Version() *Version }
Request is the interface for a synchronous request used by Call or Stream.
type Response ¶
type Response interface { // Read the response Codec() codec.Reader // read the header Header() map[string]string // Read the undecoded response Read() ([]byte, error) }
Response is the response received from a service.
type Stream ¶
type Stream interface { CloseSend() error // Context for the stream Context() context.Context // The request made Request() Request // The response read Response() Response // Send will encode and send a request Send(interface{}) error // Recv will decode and read a response Recv(interface{}) error // Error returns the stream error Error() error // Close closes the stream Close() error }
Stream is the inteface for a bidirectional synchronous stream.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package client is an interface for an RPC client
|
Package client is an interface for an RPC client |
Package codec is an interface for encoding messages
|
Package codec is an interface for encoding messages |
grpc
Package grpc provides a grpc codec
|
Package grpc provides a grpc codec |
Package errors provides a way to return detailed information for an RPC request error.
|
Package errors provides a way to return detailed information for an RPC request error. |
cache
Package cache provides a registry cache
|
Package cache provides a registry cache |
Package transport is an interface for synchronous connection based communication
|
Package transport is an interface for synchronous connection based communication |
flock
Package flock implements a thread-safe interface for file locking.
|
Package flock implements a thread-safe interface for file locking. |
Click to show internal directories.
Click to hide internal directories.