backend

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchUser   = errors.New("no such user")
	ErrLoginBlocked = errors.New("too many login attempts")
)

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func New

func New(dataDir, databaseDir string,
	storeBuilder store.Builder,
	delim string,
	loginJailTime time.Duration,
	imapLimits limits.IMAP,
	panicHandler async.PanicHandler,
	database db.ClientInterface,
) (*Backend, error)

func (*Backend) AddUser

func (b *Backend) AddUser(ctx context.Context, userID string, conn connector.Connector, passphrase []byte, uidValidityGenerator imap.UIDValidityGenerator) (bool, error)

AddUser adds a new user to the backend. It returns true if the user's database was created, false if it already existed.

func (*Backend) Close

func (b *Backend) Close(ctx context.Context) error

func (*Backend) GetDelimiter added in v0.10.0

func (b *Backend) GetDelimiter() string

func (*Backend) GetMailboxMessageCounts added in v0.14.0

func (b *Backend) GetMailboxMessageCounts(ctx context.Context, userID string) (map[imap.MailboxID]int, error)

func (*Backend) GetState

func (b *Backend) GetState(ctx context.Context, username string, password []byte, sessionID int) (*state.State, error)

func (*Backend) NewUserID added in v0.9.0

func (b *Backend) NewUserID() string

func (*Backend) ReleaseState added in v0.12.0

func (b *Backend) ReleaseState(ctx context.Context, st *state.State) error

func (*Backend) RemoveUser added in v0.5.0

func (b *Backend) RemoveUser(ctx context.Context, userID string, removeFiles bool) error

type StateUserInterfaceImpl added in v0.12.0

type StateUserInterfaceImpl struct {
	// contains filtered or unexported fields
}

StateUserInterfaceImpl should be used to interface with the user type from a State type. This is meant to control the API boundary layer.

func (*StateUserInterfaceImpl) GenerateUIDValidity added in v0.15.0

func (s *StateUserInterfaceImpl) GenerateUIDValidity() (imap.UID, error)

func (*StateUserInterfaceImpl) GetDB added in v0.12.0

func (s *StateUserInterfaceImpl) GetDB() db.Client

func (*StateUserInterfaceImpl) GetDelimiter added in v0.12.0

func (s *StateUserInterfaceImpl) GetDelimiter() string

func (*StateUserInterfaceImpl) GetRecoveredMessageHashesMap added in v0.17.0

func (s *StateUserInterfaceImpl) GetRecoveredMessageHashesMap() *utils.MessageHashesMap

func (*StateUserInterfaceImpl) GetRecoveryMailboxID added in v0.14.0

func (s *StateUserInterfaceImpl) GetRecoveryMailboxID() db.MailboxIDPair

func (*StateUserInterfaceImpl) GetRemote added in v0.12.0

func (s *StateUserInterfaceImpl) GetRemote() state.Connector

func (*StateUserInterfaceImpl) GetStore added in v0.12.0

func (*StateUserInterfaceImpl) GetUserID added in v0.12.0

func (s *StateUserInterfaceImpl) GetUserID() string

func (*StateUserInterfaceImpl) QueueOrApplyStateUpdate added in v0.12.0

func (s *StateUserInterfaceImpl) QueueOrApplyStateUpdate(ctx context.Context, tx db.Transaction, updates ...state.Update) error

func (*StateUserInterfaceImpl) ReleaseState added in v0.12.0

func (s *StateUserInterfaceImpl) ReleaseState(ctx context.Context, st *state.State) error

Jump to

Keyboard shortcuts

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