Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Adaptors = map[string]Creator{}
Adaptors stores a map of adaptors by name
var ErrNamespaceMalformed = errors.New("malformed namespace, expected a '.' deliminated string")
ErrNamespaceMalformed represents the error to be returned when an invalid namespace is given.
Functions ¶
Types ¶
type Adaptor ¶
Adaptor defines the interface that all database connectors and nodes must follow. Start() consumes data from the interface, Listen() listens on a pipe, processes data, and then emits it. Stop() shuts down the adaptor
func CreateAdaptor ¶
CreateAdaptor instantiates an adaptor given the adaptor type and the Config. An Adaptor is expected to add themselves to the Adaptors map in the init() func
func init() { adaptors.Add("TYPE", func(p *pipe.Pipe, path string, extra adaptors.Config) (adaptors.StopStartListener, error) { }) }
and are expected to confirm to the Adaptor interface
type Config ¶
type Config map[string]interface{}
Config is an alias to map[string]interface{} and helps us turn a fuzzy document into a conrete named struct
func (*Config) CompileNamespace ¶
CompileNamespace split's on the first '.' and then compiles the second portion to use as the msg filter
type Connectable ¶
type Connectable interface {
Connect() error
}
Connectable defines the interface that adapters should follow to have their connections set on load Connect() allows the adaptor an opportunity to setup connections prior to Start()
type DbConfig ¶
type DbConfig struct { URI string `json:"uri" doc:"the uri to connect to, in the form mongo://user:password@host.com:8080/database"` // the database uri Namespace string `json:"namespace" doc:"mongo namespace to read/write"` // namespace Debug bool `json:"debug" doc:"display debug information"` // debug mode }
DbConfig is a standard typed config struct to use for as general purpose config for most databases.
type Describable ¶
Describable defines the interface that all database connectors and nodes must follow in order to support the help functions. SampleConfig() returns an example YAML structure to configure the adaptor Description() provides contextual information for what the adaptor is for
type ErrNotFound ¶
type ErrNotFound struct {
Name string
}
ErrNotFound gives the details of the failed adaptor
func (ErrNotFound) Error ¶
func (a ErrNotFound) Error() string
type Error ¶
type Error struct { Lvl ErrorLevel Err string Path string Record interface{} }
Error is an error that happened during an adaptor's operation. Error's include both an indication of the severity, Level, as well as a reference to the Record that was in process when the error occurred
type ErrorLevel ¶
type ErrorLevel int
ErrorLevel indicated the severity of the error
const ( NOTICE ErrorLevel = iota WARNING ERROR CRITICAL )
Adaptor errors have levels to indicate their severity. CRITICAL errors indicate that the program cannot continue running.
ERROR errors indicate a problem with a specific document or message. a document might not have been applied properly to a source, but the program can continue
WARNING Todo
NOTICE ToDo