backends

package
v0.0.0-...-2c5552e Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyAuthorizator

type DummyAuthorizator struct {
}

DummyAuthorizator is a fake authorizator interface implementation used for test

func (DummyAuthorizator) Authorize

func (a DummyAuthorizator) Authorize(user, pass string) bool

Authorize user for given username and password.

type DummyBackend

type DummyBackend struct {
}

DummyBackend is a fake backend interface implementation used for test

func (DummyBackend) Dele

func (b DummyBackend) Dele(user string, msgId int) error

Delete message by message ID - message should be just marked as deleted until Update() is called. Be aware that after Dele() is called, functions like List() etc. should ignore all these messages even if Update() hasn't been called yet

func (DummyBackend) List

func (b DummyBackend) List(user string) (octets []int, err error)

List of sizes of all messages in bytes (octets)

func (DummyBackend) ListMessage

func (b DummyBackend) ListMessage(user string, msgId int) (exists bool, octets int, err error)

Returns whether message exists and if yes, then return size of the message in bytes (octets)

func (DummyBackend) Lock

func (b DummyBackend) Lock(user string) error

Lock is called immediately after client is connected. The best way what to use Lock() for is to read all the messages into cache after client is connected. If another user tries to lock the storage, you should return an error to avoid data race.

func (DummyBackend) Retr

func (b DummyBackend) Retr(user string, msgId int) (message string, err error)

Retrieve whole message by ID - note that message ID is a message position returned by List() function, so be sure to keep that order unchanged while client is connected See Lock() function for more details

func (DummyBackend) Rset

func (b DummyBackend) Rset(user string) error

Undelete all messages marked as deleted in single connection

func (DummyBackend) Stat

func (b DummyBackend) Stat(user string) (messages, octets int, err error)

Returns total message count and total mailbox size in bytes (octets). Deleted messages are ignored.

func (DummyBackend) Uidl

func (b DummyBackend) Uidl(user string) (uids []string, err error)

List of unique IDs of all message, similar to List(), but instead of size there is a unique ID which persists the same across all connections. Uid (unique id) is used to allow client to be able to keep messages on the server.

func (DummyBackend) UidlMessage

func (b DummyBackend) UidlMessage(user string, msgId int) (exists bool, uid string, err error)

Similar to ListMessage, but returns unique ID by message ID instead of size.

func (DummyBackend) Unlock

func (b DummyBackend) Unlock(user string) error

Release lock on storage, Unlock() is called after client is disconnected.

func (DummyBackend) Update

func (b DummyBackend) Update(user string) error

Write all changes to persistent storage, i.e. delete all messages marked as deleted.

Jump to

Keyboard shortcuts

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