remote

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchUser = errors.New("no such user")
View Source
var ErrQueueClosed = errors.New("the queue is closed")

Functions

This section is empty.

Types

type ConnMetadataID added in v0.6.0

type ConnMetadataID uint32

type Manager

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

Manager provides access to remote users.

func New

func New(dir string) (*Manager, error)

New returns a new manager which stores serialized operation queues for users in the given base directory.

func (*Manager) AddUser

func (m *Manager) AddUser(userID string, conn connector.Connector) (*User, error)

AddUser adds the remote user with the given (IMAP) credentials to the remote manager. The user interacts with the remote via the given connector.

func (*Manager) GetUserID

func (m *Manager) GetUserID(username, password string) (string, error)

GetUserID returns the user ID of the user with the given credentials.

func (*Manager) RemoveUser added in v0.5.0

func (m *Manager) RemoveUser(ctx context.Context, userID string) error

RemoveUser removes the user with the given ID from the remote manager. It waits until all the user's queued operations have been performed.

type OpConnMetadataStoreCreate added in v0.6.0

type OpConnMetadataStoreCreate struct {
	OperationBase
}

type OpConnMetadataStoreDelete added in v0.6.0

type OpConnMetadataStoreDelete struct {
	OperationBase
}

type OpConnMetadataStoreSetValue added in v0.6.0

type OpConnMetadataStoreSetValue struct {
	OperationBase
	Key   string
	Value any
}

type OpMailboxCreate

type OpMailboxCreate struct {
	OperationBase
	TempID string
	Name   []string
}

type OpMailboxDelete

type OpMailboxDelete struct {
	OperationBase
	MBoxID string
}

type OpMailboxUpdate

type OpMailboxUpdate struct {
	OperationBase
	MBoxID string
	Name   []string
}

type OpMessageAdd

type OpMessageAdd struct {
	OperationBase
	MessageIDs []string
	MBoxID     string
}

type OpMessageCreate

type OpMessageCreate struct {
	OperationBase
	TempID  string
	MBoxID  string
	Literal []byte
	Flags   imap.FlagSet
	Date    time.Time
}

type OpMessageFlagged

type OpMessageFlagged struct {
	OperationBase
	MessageIDs []string
	Flagged    bool
}

type OpMessageRemove

type OpMessageRemove struct {
	OperationBase
	MessageIDs []string
	MBoxID     string
}

type OpMessageSeen

type OpMessageSeen struct {
	OperationBase
	MessageIDs []string
	Seen       bool
}

type OperationBase added in v0.6.0

type OperationBase struct {
	MetadataID ConnMetadataID
}

type User

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

User performs operations against a remote server using a connector.

func (*User) AddMessagesToMailbox

func (user *User) AddMessagesToMailbox(metadataID ConnMetadataID, messageIDs []string, mboxID string) error

AddMessageToMailbox adds the message with the given ID to the mailbox with the given ID.

func (*User) CloseAndFlushOperationQueue added in v0.7.2

func (user *User) CloseAndFlushOperationQueue()

func (*User) CloseAndSerializeOperationQueue added in v0.7.2

func (user *User) CloseAndSerializeOperationQueue() error

CloseAndSerializeOperationQueue closes the remote user.

func (*User) CreateConnMetadataStore added in v0.6.0

func (user *User) CreateConnMetadataStore(metadataID ConnMetadataID) error

func (*User) CreateMailbox

func (user *User) CreateMailbox(metadataID ConnMetadataID, name []string) (imap.Mailbox, error)

CreateMailbox creates a new mailbox with the given name.

func (*User) CreateMessage

func (user *User) CreateMessage(metadataID ConnMetadataID, mboxID string, literal []byte, flags imap.FlagSet, date time.Time) (imap.Message, error)

CreateMessage appends a message literal to the mailbox with the given ID.

func (*User) DeleteConnMetadataStore added in v0.6.0

func (user *User) DeleteConnMetadataStore(metadataID ConnMetadataID) error

func (*User) DeleteMailbox

func (user *User) DeleteMailbox(metadataID ConnMetadataID, mboxID string, name []string) error

DeleteMailbox deletes the mailbox with the given ID and name.

func (*User) GetUpdates

func (user *User) GetUpdates() <-chan imap.Update

GetUpdates returns a channel on which updates from the server are sent.

func (*User) RemoveMessagesFromMailbox

func (user *User) RemoveMessagesFromMailbox(metadataID ConnMetadataID, messageIDs []string, mboxID string) error

RemoveMessageFromMailbox removes the message with the given ID from the mailbox with the given ID.

func (*User) SetConnMetadataValue added in v0.6.0

func (user *User) SetConnMetadataValue(metadataID ConnMetadataID, key string, value any) error

func (*User) SetMessagesFlagged

func (user *User) SetMessagesFlagged(metadataID ConnMetadataID, messageIDs []string, flagged bool) error

SetMessageFlagged marks the message with the given ID as seen or unseen.

func (*User) SetMessagesSeen

func (user *User) SetMessagesSeen(metadataID ConnMetadataID, messageIDs []string, seen bool) error

SetMessageSeen marks the message with the given ID as seen or unseen.

func (*User) UpdateMailbox

func (user *User) UpdateMailbox(metadataID ConnMetadataID, mboxID string, oldName, newName []string) error

UpdateMailbox sets the name of the mailbox with the given ID to the given new name.

Directories

Path Synopsis
Package mock_remote is a generated GoMock package.
Package mock_remote is a generated GoMock package.

Jump to

Keyboard shortcuts

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