storage

package
v0.0.0-...-3a0566b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2015 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Contains all backends for gost. Backends are basic storage engines that can store a received email and retreive the email at a later date. When an email is stored in a backend it should be guaranteed persisted for at least `config.GetEmailTTL()` seconds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Puts the given email into the backend, returning its unique ID.
	PutEmail(e *email.SMTPEmail) (id email.EmailId, err error)
	// Gets the given email from the backend by its unique ID.
	// If the email is not found, returns nil and nil.
	// The struct retreived may or may not be the same struct stored,
	// but they must have the same data.
	GetEmail(id email.EmailId) (e *email.SMTPEmail, err error)
	// Initializes the backend.
	// If an error returns, the backend should NOT be used.
	// Initialization should NOT be re-attempted.
	Initialize() error
	// Safely shuts down the backend.
	// Backends are required to shut down when notified by system-wide shutdown
	// module. This method is rather to instruct the specific backend connector to
	// shutdown. Not required to block until shutdown succeeds
	Shutdown()
}

An abstract representation of an email storage backend.

func GetBackend

func GetBackend() (Backend, error)

Gets the backend as set in configuration. The backend returned is already initialized.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL