Documentation
¶
Overview ¶
Package registry provides a central way to register and use all available feedback plugins. All plugins should be registered prior to the program starting, normally through init().
Index ¶
- func GetFeedbackPlugins(name string) (func() FeedbackPlugin, bool)
- func GetNamesOfFeedbackPlugins() []string
- func RegisterAuthenticater(a Authenticater, name string) error
- func RegisterFeedbackPlugin(fp func() FeedbackPlugin, name string) error
- type AlreadyRegisteredError
- type Authenticater
- type DataFeedbackPlugin
- type DownloadResultPlugin
- type FeedbackPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFeedbackPlugins ¶
func GetFeedbackPlugins(name string) (func() FeedbackPlugin, bool)
GetFeedbackPlugins returns a feedback plugin. The bool indicates whether it existed. You can only use it if the bool is true.
func GetNamesOfFeedbackPlugins ¶
func GetNamesOfFeedbackPlugins() []string
GetNamesOfFeedbackPlugins returns a list of names of all known Feedback plugins. The list is sorted alphabetically.
func RegisterAuthenticater ¶
func RegisterAuthenticater(a Authenticater, name string) error
RegisterAuthenticater registeres an authenticater. The name of the authenticater is used as an identifier and must be unique. You can savely use it in parallel.
func RegisterFeedbackPlugin ¶
func RegisterFeedbackPlugin(fp func() FeedbackPlugin, name string) error
RegisterFeedbackPlugin registeres a data safe. The name of the data safe is used as an identifier and must be unique. You can savely use it in parallel.
Types ¶
type AlreadyRegisteredError ¶
type AlreadyRegisteredError string
AlreadyRegisteredError represents an error where an option is already registeres
func (AlreadyRegisteredError) Error ¶
func (a AlreadyRegisteredError) Error() string
Error returns the error description
type Authenticater ¶
type Authenticater interface {
LoadConfig(b []byte) error
Authenticate(user, password string) (bool, error)
}
Authenticater allows to validate a username/password combination. It can safely be assumed that LoadConfig will only be called once before Authenticate will be called. Authenticate must be safely callable in parallel.
func GetAuthenticater ¶
func GetAuthenticater(name string) (Authenticater, bool)
GetAuthenticater returns a authenticater. The bool indicates whether it existed. You can only use it if the bool is true.
type DataFeedbackPlugin ¶
type DataFeedbackPlugin interface {
FeedbackPlugin
AdminDataChannel(chan<- []byte)
UserDataChannel(chan<- []byte)
}
DataFeedbackPlugin is an extended version of FeedbackPlugin allowing to send data without replacing the HTML page
type DownloadResultPlugin ¶
type DownloadResultPlugin interface {
FeedbackPlugin
GetAdminDownload() []byte
}
DownloadResultPlugin is an extended version of FeedbackPlugin allowing to download current results
type FeedbackPlugin ¶
type FeedbackPlugin interface {
ConfigHTML() (string, template.HTML) // Name, HTML
AdminHTMLChannel(chan<- template.HTML)
UserHTMLChannel(chan<- template.HTML)
ReceiveUserChannel(<-chan []byte)
ReceiveAdminChannel(<-chan []byte)
Activate([]byte) error
Deactivate()
GetLastHTMLUser() template.HTML
GetLastHTMLAdmin() template.HTML
}
FeedbackPlugin represents an element for giving feedback