Documentation ¶
Overview ¶
Package service defines the interface that fleetspeak expects from its service implementations.
An installation can provide the set of ServiceFactories which it requires, and then the factories will be used, according to the server configuration, to create the server services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTemporary ¶
IsTemporary determines if an error should be retried by the fleetspeak system.
Types ¶
type Context ¶
type Context interface { // Set sends a message to a client machine or other server component. It can be called // anytime after Service.Start begins and before Service.Stop returns. Send(context.Context, *fspb.Message) error // GetClientData retrieves basic information about a client. GetClientData(context.Context, common.ClientID) (*db.ClientData, error) }
Context allows a Fleetspeak Service to communicate back to the Fleetspeak system.
type Factory ¶
type Factory func(*spb.ServiceConfig) (Service, error)
A Factory is a function which creates a server service for the provided configuration.
type Service ¶
type Service interface { // Start tells the service to begin operations. Once started, the service may make // calls into ServiceContext until Wait is called. Start(sctx Context) error // ProcessMessage requests that the service process a message. If it returns a // net.Error which reports as a timeout or temporary error, the message will // be retried according the ServerRetryPolicy. Otherwise the error will be // assumed to be permanent. ProcessMessage(context.Context, *fspb.Message) error // Stop initiates and waits for an orderly shut down. It will only be // called when there are no more active calls to ProcessMessage and // should not return until all calls to ServiceContext are completed. Stop() error }
A Service is a Fleetspeak module configured to send and processes messages on a Fleetspeak server.
func NOOPFactory ¶
func NOOPFactory(conf *spb.ServiceConfig) (Service, error)
NOOPFactory is a services.Factory that creates a service which drops all messages.
type TemporaryError ¶
type TemporaryError struct {
E error
}
TemporaryError wraps an error and indicates that ProcessMessage should be retried some time in the future.
func (TemporaryError) Error ¶
func (e TemporaryError) Error() string
Error implements error by trivial delegation to E.
func (TemporaryError) Temporary ¶
func (e TemporaryError) Temporary() bool
Temporary implements net.Error.
func (TemporaryError) Timeout ¶
func (e TemporaryError) Timeout() bool
Timeout implements net.Error.