Documentation
¶
Overview ¶
Package storage contains implementation independent datastore logic
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotExist indicates the requested message does not exist. ErrNotExist = errors.New("message does not exist") // ErrNotWritable indicates the message is closed; no longer writable ErrNotWritable = errors.New("Message not writable") // Constructors tracks registered storage constructors Constructors = make(map[string]func(config.Storage) (Store, error)) )
Functions ¶
This section is empty.
Types ¶
type HashLock ¶
HashLock holds a fixed length array of mutexes. This approach allows concurrent mailbox access in most cases without requiring an infinite number of mutexes.
type Message ¶
type Message interface { Mailbox() string ID() string From() *mail.Address To() []*mail.Address Date() time.Time Subject() string Source() (io.ReadCloser, error) Size() int64 Seen() bool }
Message represents a message to be stored, or returned from a storage implementation.
type RetentionScanner ¶
type RetentionScanner struct {
// contains filtered or unexported fields
}
RetentionScanner looks for messages older than the configured retention period and deletes them.
func NewRetentionScanner ¶
func NewRetentionScanner( cfg config.Storage, ds Store, shutdownChannel chan bool, ) *RetentionScanner
NewRetentionScanner configures a new RententionScanner.
func (*RetentionScanner) DoScan ¶
func (rs *RetentionScanner) DoScan() error
DoScan does a single pass of all mailboxes looking for messages that can be purged.
func (*RetentionScanner) Join ¶
func (rs *RetentionScanner) Join()
Join does not return until the retention scanner has shut down.
func (*RetentionScanner) Start ¶
func (rs *RetentionScanner) Start()
Start up the retention scanner if retention period > 0
type Store ¶
type Store interface { // AddMessage stores the message, message ID and Size will be ignored. AddMessage(message Message) (id string, err error) GetMessage(mailbox, id string) (Message, error) GetMessages(mailbox string) ([]Message, error) MarkSeen(mailbox, id string) error PurgeMessages(mailbox string) error RemoveMessage(mailbox, id string) error VisitMailboxes(f func([]Message) (cont bool)) error //mailbox AddAllowedMailbox(string) error RemoveAllowedMailbox(string) error KeepaliveAllowedMailbox(string) error IsMailboxAllow(string, time.Duration) bool CleanupExpiredMailbox(period time.Duration) int //mailhost AddAllowedMailhost(host string, weight int) error RemoveAllowedMailhost(id string) error UpdateMailhost(id string, host string, weight int) error ListMailhost() []Mailhost }
Store is the interface TempMail uses to interact with storage implementations.
Directories
¶
Path | Synopsis |
---|---|
* ===================================================================================== * * Package: mongo * Filename: ${FILENAME} * * Description: tempmail * * Created: 9/23/18 9:25 AM * * Author: hacklog * URL: http://80x86.io * * =====================================================================================
|
* ===================================================================================== * * Package: mongo * Filename: ${FILENAME} * * Description: tempmail * * Created: 9/23/18 9:25 AM * * Author: hacklog * URL: http://80x86.io * * ===================================================================================== |