Documentation ¶
Overview ¶
Package registry provides a central way to register and use all available saving backends. All options should be registered prior to the program starting, normally through init().
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAuthenticater ¶
func RegisterAuthenticater(a Authenticater, name string) error
RegisterDataSafe 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.
func RegisterDataSafe ¶
RegisterDataSafe 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)
GetDataSafe returns a data safe. The bool indicates whether it existed. You can only use it if the bool is true.
type DataSafe ¶
type DataSafe interface { SavePollResult(pollID, name, comment string, results []int, change string) (string, error) OverwritePollResult(pollID, answerID, name, comment string, results []int, change string) error GetPollResult(pollID string) (results [][]int, name []string, comment []string, answerIDs []string, err error) GetSinglePollResult(pollID, answerID string) (result []int, name string, comment string, err error) DeleteAnswer(pollID, answerID string) error SavePollConfig(pollID string, config []byte) error GetPollConfig(pollID string) ([]byte, error) SavePollCreator(pollID, name string) error GetPollCreator(pollID string) (string, error) MarkPollDeleted(pollID string) error GetChange(pollID, answerID string) (string, error) RunGC() error LoadConfig(data []byte) error FlushAndClose() }
DataSafe represents a backend for save storage of poll configuration and results. All results must be stored in the same order they are added. All methods must be save for parallel usage.
func GetDataSafe ¶
GetDataSafe returns a data safe. The bool indicates whether it existed. You can only use it if the bool is true.