Documentation
¶
Overview ¶
Package micro is a pluggable framework for microservices
Index ¶
- func RegisterHandler(s server.Server, h interface{}) error
- type Option
- func Action(a func(*cli.Context)) Option
- func Address(addr string) Option
- func AfterStart(fn func() error) Option
- func AfterStop(fn func() error) Option
- func BeforeStart(fn func() error) Option
- func BeforeStop(fn func() error) Option
- func Client(c client.Client) Option
- func Connector(ct connector.Connector) Option
- func Context(ctx context.Context) Option
- func Flags(flags ...cli.Flag) Option
- func Logger(l log.Logger) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func RegisterInterval(t time.Duration) Option
- func RegisterTTL(t time.Duration) Option
- func Registry(r registry.Registry) Option
- func Selector(s selector.Selector) Option
- func Server(s server.Server) Option
- func Transport(t transport.Transport) Option
- func Version(v string) Option
- func WrapCall(w ...client.CallWrapper) Option
- func WrapClient(w ...client.Wrapper) Option
- func WrapHandler(w ...server.HandlerWrapper) Option
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandler ¶
RegisterHandler is syntactic sugar for registering a handler
Types ¶
type Option ¶
type Option func(*Options)
Option option
func Context ¶
Context specifies a context for the service. Can be used to signal shutdown of the service. Can be used for extra option values.
func RegisterInterval ¶
RegisterInterval specifies the interval on which to re-register
func RegisterTTL ¶
RegisterTTL specifies the TTL to use when registering the service
func WrapCall ¶
func WrapCall(w ...client.CallWrapper) Option
WrapCall is a convenience method for wrapping a Client CallFunc
func WrapClient ¶
WrapClient is a convenience method for wrapping a Client with some middleware component. A list of wrappers can be provided. Wrappers are applied in reverse order so the last is executed first.
func WrapHandler ¶
func WrapHandler(w ...server.HandlerWrapper) Option
WrapHandler adds a handler Wrapper to a list of options passed into the server
type Options ¶
type Options struct {
Logger log.Logger
Client client.Client
Server server.Server
Registry registry.Registry
Transport transport.Transport
// Flags and Action
Flags []cli.Flag
Action func(*cli.Context)
// Before and After funcs
BeforeStart []func() error
BeforeStop []func() error
AfterStart []func() error
AfterStop []func() error
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
Options options
type Service ¶
type Service interface {
Init(...Option)
Options() Options
Client() client.Client
Server() server.Server
Run() error
String() string
}
Service is an interface that wraps the lower level libraries within v-micro. Its a convenience method for building and initialising services.
func NewService ¶
NewService creates and returns a new Service based on the packages within.
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 |
|
proto
Package proto provides a proto codec
|
Package proto provides a proto codec |
|
common
|
|
|
log
Package log is a global internal logger
|
Package log is a global internal logger |
|
metadata
Package metadata is a way of defining message headers
|
Package metadata is a way of defining message headers |
|
examples
|
|
|
broadcast/broadcast_client
command
|
|
|
broadcast/broadcast_server
command
|
|
|
echo/echo_client
command
|
|
|
echo/echo_server
command
|
|
|
filter/filter_client
command
|
|
|
filter/filter_server
command
|
|
|
flags
command
|
|
|
hello/hello_client
command
|
|
|
hello/hello_server
command
|
|
|
metadata/metadata_client
command
|
|
|
metadata/metadata_server
command
|
|
|
registry
command
|
|
|
internal
|
|
|
Package registry is an interface for service discovery
|
Package registry is an interface for service discovery |
|
mdns
Package mdns is a multicast dns registry
|
Package mdns is a multicast dns registry |
|
Package selector is a way to pick a list of service nodes
|
Package selector is a way to pick a list of service nodes |
|
cache
Package cache provides a registry cache
|
Package cache provides a registry cache |
|
Package server is an interface for a micro server
|
Package server is an interface for a micro server |