Documentation ¶
Overview ¶
Package output contains types to handle data on the internet side; ie various protocols for systems somewhere in the cloud.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownOutputType is returned when the output type is // unknown or incorrect- ErrUnknownOutputType = errors.New("unknown output type") // ErrInvalidConfig is returned when one or more of the output's // configuration parameters are invalid. ErrInvalidConfig = errors.New("invalid output config") )
Functions ¶
func DisableLocalhostChecks ¶
func DisableLocalhostChecks()
DisableLocalhostChecks turns OFF checks for outputs to localhost This shoudln't be enabled in production but is very useful when testing on your local computer or during unit testing where servers are running locally
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the in-memory logger used by the outputs. The logger keeps track of the log messages.
func (*Logger) Entries ¶
func (l *Logger) Entries() []model.OutputLogEntry
Entries returns the log entries
type Manager ¶
type Manager interface { // Verify checks the output's configuration without launching it Verify(model.Output) (model.ErrorMessage, error) // Load loads outputs from backend store and launches the ones that aren't // up and running yet. The Load call might be performed multiple times to // update the list. The field mask is the system-level field mask, ie forced // field mask Refresh([]model.Output, model.FieldMask) // Update refreshes the output. If it isn't launched yet it will be // launched. If it is already running the new configuration will be // applied. The field mask is the system field mask, ie the forced // field mask Update(model.Output, model.FieldMask) error // Stop stops a single output, typically if they have been deleted. Stop(model.OutputKey) error // Shutdown shuts down all of the running outputs. Shutdown() // Get returns the output. If the output isn't running or is unknown it // will return an error. The output includes the current logs. Get(model.OutputKey) (Output, error) // Publish publishes a data message to the running outputs. If there's no // outputs subscribing to the data it will be discarded. Publish(model.DataMessage) // Subscribe subscribes to a topic Subscribe(collectionID model.CollectionKey) <-chan interface{} // Unsubscribe unsubscribes from a topic Unsubscribe(ch <-chan interface{}) }
Manager is responsible for keeping track of outputs and the mapping between the storage outputs and the actual running outputs.
func NewDummyManager ¶
func NewDummyManager() Manager
NewDummyManager For testing: Return a dummy manager
func NewLocalManager ¶
func NewLocalManager() Manager
NewLocalManager creates a new manager running locally
type Output ¶
type Output interface { // Validate verifies the configuraton for the output. Error messages that // should be provided to the end user is returned as the 2nd parameter. // On success the error return value is nil. Validate(config model.OutputConfig) (model.ErrorMessage, error) // Start launches the output. This is non blocking, ie if the output // must connect to a remote server or perform some sort initialization it // will do so in a separate goroutine. The output will stop automatically // when the message channel is closed. If the message channel is closed // the output should attempt empty any remaining messages in the queue. Start(config model.OutputConfig, collectionFieldMask model.FieldMask, systemFieldMask model.FieldMask, message <-chan interface{}) // Stop halts the output. Any buffered messages that can't be sent during // the timeout will be discarded by the output. When the Stop call returns // the output has stopped. Stop(timeout time.Duration) // Logs returns end user logs for the output. Logs() []model.OutputLogEntry // Status reports the internal status of the forwarder. Status() model.OutputStatus }
Output defines the interface for the various outputs. Outputs forwards data from Horde to external servers. Outputs can be stateless (webhooks) or have a connection state but they behave similarly. Messages will be cached for minor network glitches.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package outputconfig contains constants for the output configuration.
|
Package outputconfig contains constants for the output configuration. |