Documentation
¶
Index ¶
- type AuthOptions
- type BrokerOptions
- type ClientOptions
- type ConfigOptions
- type Function
- type LoggerOptions
- type Option
- func Address(addr string) Option
- func AfterStart(fn func() error) Option
- func AfterStop(fn func() error) Option
- func Auth(au auth.Auth) Option
- func BeforeInit(fn func(sOpts *Options) error) Option
- func BeforeStart(fn func() error) Option
- func BeforeStop(fn func() error) Option
- func Broker(b broker.Broker) Option
- func Client(c client.Client) Option
- func Cmd(c cmd.Cmd) Option
- func Config(c config.Config) Option
- func Context(ctx context.Context) Option
- func HandleSignal(b bool) Option
- func Id(id string) Option
- func Logger(l logger.Logger) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func Profile(p profile.Profile) Option
- func RPC(r 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
- func WrapSubscriber(w ...server.SubscriberWrapper) Option
- type Options
- type RegistryOptions
- type SelectorOptions
- type ServerOptions
- type Service
- type TransportOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthOptions ¶
func (AuthOptions) Options ¶
func (a AuthOptions) Options() auth.Options
type BrokerOptions ¶
func (BrokerOptions) Options ¶
func (b BrokerOptions) Options() broker.Options
type ClientOptions ¶
func (ClientOptions) Options ¶
func (c ClientOptions) Options() client.Options
type ConfigOptions ¶
func (ConfigOptions) Options ¶
func (c ConfigOptions) Options() config.Options
type Function ¶
type Function interface {
// Inherits Service interface
Service
// Done signals to complete execution
Done() error
// Handle registers an RPC handler
Handle(v interface{}) error
// Subscribe registers a subscriber
Subscribe(topic string, v interface{}) error
}
Function is a one time executing Service
type LoggerOptions ¶
func (LoggerOptions) Options ¶
func (c LoggerOptions) Options() logger.Options
type Option ¶
type Option func(o *Options)
func AfterStart ¶
func BeforeInit ¶
func BeforeStart ¶
func BeforeStop ¶
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 HandleSignal ¶
HandleSignal toggles automatic installation of the signal handler that traps TERM, INT, and QUIT. Users of this feature to disable the signal handler, should control liveness of the service through the context.
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
func WrapSubscriber ¶
func WrapSubscriber(w ...server.SubscriberWrapper) Option
WrapSubscriber adds a subscriber Wrapper to a list of options passed into the server
type Options ¶
type Options struct {
// maybe put them in metadata is better
Id string
Name string
RPC string
Cmd cmd.Cmd
Conf string
BrokerOptions BrokerOptions
ClientOptions ClientOptions
ServerOptions ServerOptions
RegistryOptions RegistryOptions
TransportOptions TransportOptions
SelectorOptions SelectorOptions
ConfigOptions ConfigOptions
LoggerOptions LoggerOptions
AuthOptions AuthOptions
Broker broker.Broker
Client client.Client
Server server.Server
Registry registry.Registry
Transport transport.Transport
Selector selector.Selector
Config config.Config
Logger logger.Logger
Auth auth.Auth
Profile profile.Profile
// Before and After funcs
BeforeInit []func(sOpts *Options) error
BeforeStart []func() error
BeforeStop []func() error
AfterStart []func() error
AfterStop []func() error
ClientWrapper []client.Wrapper
CallWrapper []client.CallWrapper
HandlerWrapper []server.HandlerWrapper
SubscriberWrapper []server.SubscriberWrapper
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
Signal bool
}
type RegistryOptions ¶
func (RegistryOptions) Options ¶
func (c RegistryOptions) Options() registry.Options
type SelectorOptions ¶
func (SelectorOptions) Options ¶
func (c SelectorOptions) Options() selector.Options
type ServerOptions ¶
func (ServerOptions) Options ¶
func (c ServerOptions) Options() server.Options
type Service ¶
type Service interface {
// The service name
Name() string
// Init initialises options
Init(...Option) error
// Options returns the current options
Options() Options
// Client is used to call services
Client() client.Client
// Server is for handling requests and events
Server() server.Server
// Run the service
Run() error
// The service implementation
String() string
}
Service is an interface that wraps the lower level libraries within stack-rpc. Its a convenience method for building and initialising services.
type TransportOptions ¶
func (TransportOptions) Options ¶
func (c TransportOptions) Options() transport.Options