Documentation
¶
Index ¶
- type Backend
- func (b *Backend) Authorize(user, pass string) bool
- func (b *Backend) Dele(user string, msgId int) error
- func (b *Backend) List(user string) (octets []int, err error)
- func (b *Backend) ListMessage(user string, msgId int) (exists bool, octets int, err error)
- func (b *Backend) Lock(user string) error
- func (b *Backend) Poll(ctx context.Context, user string) error
- func (b *Backend) Retr(user string, msgId int) (message string, err error)
- func (b *Backend) Rset(user string) error
- func (b *Backend) Stat(user string) (messages, octets int, err error)
- func (b *Backend) Top(user string, msgId int, n int) (lines []string, err error)
- func (b *Backend) Uidl(user string) (uids []string, err error)
- func (b *Backend) UidlMessage(user string, msgId int) (exists bool, uid string, err error)
- func (b *Backend) Unlock(user string) error
- func (b *Backend) Update(user string) error
- type Server
- type ServerOptions
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a fake backend interface implementation used for test
func NewBackend ¶
func NewBackend(dumpClient pb.DMSDumpServiceClient, lookupClient pb.LookupServiceClient, privateKey *easyecc.PrivateKey, user, password string, localStore store.Store) *Backend
func (*Backend) Dele ¶
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 (*Backend) ListMessage ¶
Returns whether message exists and if yes, then return size of the message in bytes (octets)
func (*Backend) Lock ¶
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 (*Backend) Retr ¶
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 (*Backend) Stat ¶
Returns total message count and total mailbox size in bytes (octets). Deleted messages are ignored.
func (*Backend) Uidl ¶
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 (*Backend) UidlMessage ¶
Similar to ListMessage, but returns unique ID by message ID instead of size.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts *ServerOptions) *Server
func (*Server) ListenAndServe ¶
type ServerOptions ¶
type Session ¶
type Session struct { PrivateKey *easyecc.PrivateKey Messages []*pb.DMSMessage Deleted []bool }