Documentation ¶
Index ¶
- Constants
- Variables
- type MailStore
- func (store *MailStore) Add(key string, mailData instances.Mail) error
- func (store *MailStore) GetMultiple(keys []string) (mails map[string]instances.Mail, err error, notFoundKeys []string)
- func (store *MailStore) GetSingle(key string) (instances.Mail, error)
- func (store *MailStore) Set(key string, data instances.Mail)
Constants ¶
const EventDispatcher = "MailStore"
const NewMailStoredEvent event.Event = "newMailStored"
Variables ¶
var ( AlreadyExistsError = errors.New("key already exists. Use Set() if you want to add/override key") KeyNotExistsError = errors.New("given key does not exist") )
Functions ¶
This section is empty.
Types ¶
type MailStore ¶
type MailStore struct {
// contains filtered or unexported fields
}
MailStore holds a bunch of instances.Mail within a map and notifies via the message queue on mail updates
func CreateMailStore ¶
func CreateMailStore(messageQueue event.Dispatcher) *MailStore
CreateMailStore always creates and returns a new MailStore. Needs a event.Dispatcher to notify others on mail updates
func (*MailStore) Add ¶
Add puts a instances.Mail into the internal map with the given key if the key not exists. Key can be any string but should be recreatable for receiving purposes Returns an AlreadyExistsError if key exists in Map
func (*MailStore) GetMultiple ¶
func (store *MailStore) GetMultiple(keys []string) (mails map[string]instances.Mail, err error, notFoundKeys []string)
GetMultiple retrieves multiple mails for a given key slice. If any of the keys not exist, a KeyNotExistsError will be returned but the function will still gather the rest. Any not found key will be within the notFoundKeys return parameter