Documentation
¶
Index ¶
Constants ¶
const ( DefaultLogLevel = "info" DefaultShutdownTimeout = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.6
type Config struct {
// contains filtered or unexported fields
}
Config holds the configuration information for a multiprotocol server.
func (Config) LogLevel ¶ added in v0.2.6
LogLevel returns the logging level. The default level is "info".
func (Config) ShutdownTimeout ¶ added in v0.2.6
ShutdownTimeout returns the server shutdown timeout.
type MultiprotocolServer ¶
type MultiprotocolServer struct {
// contains filtered or unexported fields
}
MultiprotocolServer manages servers that provide services with mutliple protocols.
func New ¶
func New(version, branch, commit, date string, opts ...Option) (*MultiprotocolServer, error)
New returns a new multiprotocol server.
func (MultiprotocolServer) Ctx ¶
func (s MultiprotocolServer) Ctx() context.Context
Ctx returns the context used by this server.
func (*MultiprotocolServer) Register ¶ added in v0.2.7
func (s *MultiprotocolServer) Register(ctx context.Context, servers ...ProtocolServer)
func (MultiprotocolServer) Serve ¶
func (s MultiprotocolServer) Serve() error
Serve starts the protocol servers, waits for them to start (or fail), and then shuts down the servers.
func (MultiprotocolServer) Shutdown ¶
func (s MultiprotocolServer) Shutdown()
Shutdown halts the server.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option provides options for configuring the creation of a multiprotocol server.
func WithLogLevel ¶
WithLogLevel sets the loglevel for the multiprotocol server.
func WithShutdownTimeout ¶
WithShutdownTimeout defines the maximum amount of time allowed to gracefully shutdown the protocol servers.
type ProtocolServer ¶
type ProtocolServer interface {
// Serve starts the server. This will be run in its own go routine.
Serve(context.Context) error
// Shutdown a protocol server. Calling shutdown for a server that returns
// an erro from Serve must be a noop.
Shutdown(context.Context)
// Name returns the name of the server.
Name() string
}
ProtocolServer defines the behavior expended from a protocol server.