Documentation ¶
Index ¶
- Constants
- Variables
- func BuildFlagSetFromMessageMetadata(message proton.MessageMetadata) imap.FlagSet
- func DeleteSyncState(configDir, userID string) error
- func GetMailboxName(label proton.Label) []string
- func GetSyncConfigPath(path string, userID string) string
- func MigrateVaultSettings(configDir, userID string, hasLabels, hasMessages bool, ...) (bool, error)
- func WantLabel(label proton.Label) bool
- type APIClient
- type CacheAccessor
- type Connector
- func (s *Connector) AddMessagesToMailbox(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) error
- func (s *Connector) Authorize(ctx context.Context, username string, password []byte) bool
- func (s *Connector) Close(_ context.Context) error
- func (s *Connector) CreateMailbox(ctx context.Context, _ connector.IMAPStateWrite, name []string) (imap.Mailbox, error)
- func (s *Connector) CreateMessage(ctx context.Context, _ connector.IMAPStateWrite, mailboxID imap.MailboxID, ...) (imap.Message, []byte, error)
- func (s *Connector) DeleteMailbox(ctx context.Context, _ connector.IMAPStateWrite, mboxID imap.MailboxID) error
- func (s *Connector) GetMailboxVisibility(_ context.Context, mboxID imap.MailboxID) imap.MailboxVisibility
- func (s *Connector) GetMessageLiteral(ctx context.Context, id imap.MessageID) ([]byte, error)
- func (s *Connector) GetUpdates() <-chan imap.Update
- func (s *Connector) Init(ctx context.Context, cache connector.IMAPState) error
- func (s *Connector) MarkMessagesFlagged(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) error
- func (s *Connector) MarkMessagesForwarded(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) error
- func (s *Connector) MarkMessagesSeen(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) error
- func (s *Connector) MoveMessages(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) (bool, error)
- func (s *Connector) RemoveMessagesFromMailbox(ctx context.Context, _ connector.IMAPStateWrite, messageIDs []imap.MessageID, ...) error
- func (s *Connector) ShowAllMail(v bool)
- func (s *Connector) StateClose()
- func (s *Connector) UpdateMailboxName(ctx context.Context, _ connector.IMAPStateWrite, mboxID imap.MailboxID, ...) error
- type EventProvider
- type GluonIDProvider
- type IMAPServerManager
- type NullIMAPServerManager
- type Service
- func (s *Service) Close()
- func (s *Service) GetLabels(ctx context.Context) (map[string]proton.Label, error)
- func (s *Service) GetSyncFailedMessageIDs(ctx context.Context) ([]string, error)
- func (s *Service) HandleAddressEvents(ctx context.Context, events []proton.AddressEvent) error
- func (s *Service) HandleLabelEvents(ctx context.Context, events []proton.LabelEvent) error
- func (s *Service) HandleMessageEvents(ctx context.Context, events []proton.MessageEvent) error
- func (s *Service) HandleRefreshEvent(ctx context.Context, _ proton.RefreshFlag) error
- func (s *Service) HandleUserEvent(_ context.Context, user *proton.User) error
- func (s *Service) OnBadEvent(ctx context.Context) error
- func (s *Service) OnBadEventResync(ctx context.Context) error
- func (s *Service) OnLogout(ctx context.Context) error
- func (s *Service) Resync(ctx context.Context) error
- func (s *Service) SetAddressMode(ctx context.Context, mode usertypes.AddressMode) error
- func (s *Service) ShowAllMail(ctx context.Context, v bool) error
- func (s *Service) Start(ctx context.Context, group *orderedtasks.OrderedCancelGroup, ...) error
- type SharedCache
- type SyncMessageBuilder
- type SyncState
- func (s *SyncState) AddFailedMessageID(_ context.Context, ids ...string) error
- func (s *SyncState) ClearSyncStatus(_ context.Context) error
- func (s *SyncState) GetSyncStatus(_ context.Context) (syncservice.Status, error)
- func (s *SyncState) RemFailedMessageID(_ context.Context, ids ...string) error
- func (s *SyncState) SetHasLabels(_ context.Context, b bool) error
- func (s *SyncState) SetHasMessages(_ context.Context, b bool) error
- func (s *SyncState) SetLastMessageID(_ context.Context, s2 string, i int64) error
- func (s *SyncState) SetMessageCount(_ context.Context, i int64) error
- type SyncUpdateApplier
- func (s *SyncUpdateApplier) ApplySyncUpdates(ctx context.Context, updates []syncservice.BuildResult) error
- func (s *SyncUpdateApplier) Close()
- func (s *SyncUpdateApplier) SyncLabels(ctx context.Context, labels map[string]proton.Label) error
- func (s *SyncUpdateApplier) SyncSystemLabelsOnly(ctx context.Context, labels map[string]proton.Label) error
- type Telemetry
Constants ¶
View Source
const SyncFileVersion = 1
Variables ¶
View Source
var ErrCacheNotAvailable = errors.New("cache no longer available")
View Source
var ErrInvalidSyncFileVersion = errors.New("invalid sync file version")
Functions ¶
func DeleteSyncState ¶
func GetMailboxName ¶
func GetMailboxName(label proton.Label) []string
func GetSyncConfigPath ¶ added in v3.5.2
func MigrateVaultSettings ¶
Types ¶
type APIClient ¶
type APIClient interface { CreateLabel(ctx context.Context, req proton.CreateLabelReq) (proton.Label, error) GetLabel(ctx context.Context, labelID string, labelTypes ...proton.LabelType) (proton.Label, error) UpdateLabel(ctx context.Context, labelID string, req proton.UpdateLabelReq) (proton.Label, error) DeleteLabel(ctx context.Context, labelID string) error LabelMessages(ctx context.Context, messageIDs []string, labelID string) error UnlabelMessages(ctx context.Context, messageIDs []string, labelID string) error GetLabels(ctx context.Context, labelTypes ...proton.LabelType) ([]proton.Label, error) GetGroupedMessageCount(ctx context.Context) ([]proton.MessageGroupCount, error) GetMessage(ctx context.Context, messageID string) (proton.Message, error) GetMessageMetadataPage(ctx context.Context, page, pageSize int, filter proton.MessageFilter) ([]proton.MessageMetadata, error) GetAllMessageIDs(ctx context.Context, afterID string) ([]string, error) CreateDraft(ctx context.Context, addrKR *crypto.KeyRing, req proton.CreateDraftReq) (proton.Message, error) UploadAttachment(ctx context.Context, addrKR *crypto.KeyRing, req proton.CreateAttachmentReq) (proton.Attachment, error) ImportMessages(ctx context.Context, addrKR *crypto.KeyRing, workers, buffer int, req ...proton.ImportReq) (proton.ImportResStream, error) GetFullMessage(ctx context.Context, messageID string, scheduler proton.Scheduler, storageProvider proton.AttachmentAllocator) (proton.FullMessage, error) GetAttachmentInto(ctx context.Context, attachmentID string, reader io.ReaderFrom) error GetAttachment(ctx context.Context, attachmentID string) ([]byte, error) DeleteMessage(ctx context.Context, messageIDs ...string) error MarkMessagesRead(ctx context.Context, messageIDs ...string) error MarkMessagesUnread(ctx context.Context, messageIDs ...string) error MarkMessagesForwarded(ctx context.Context, messageIDs ...string) error MarkMessagesUnForwarded(ctx context.Context, messageIDs ...string) error }
type CacheAccessor ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector contains all IMAP state required to satisfy sync and or imap queries.
func NewConnector ¶
func NewConnector( addrID string, apiClient APIClient, labels sharedLabels, identityState sharedIdentity, addressMode usertypes.AddressMode, sendRecorder *sendrecorder.SendRecorder, panicHandler async.PanicHandler, telemetry Telemetry, reporter reporter.Reporter, showAllMail bool, syncState *SyncState, ) *Connector
func (*Connector) AddMessagesToMailbox ¶
func (*Connector) CreateMailbox ¶
func (*Connector) CreateMessage ¶
func (*Connector) DeleteMailbox ¶
func (*Connector) GetMailboxVisibility ¶
func (*Connector) GetMessageLiteral ¶
func (*Connector) GetUpdates ¶
func (*Connector) MarkMessagesFlagged ¶
func (*Connector) MarkMessagesForwarded ¶ added in v3.7.1
func (*Connector) MarkMessagesSeen ¶
func (*Connector) MoveMessages ¶
func (*Connector) RemoveMessagesFromMailbox ¶
func (*Connector) ShowAllMail ¶
func (*Connector) StateClose ¶
func (s *Connector) StateClose()
type EventProvider ¶
type EventProvider interface { userevents.Subscribable RewindEventID(ctx context.Context, eventID string) error }
type GluonIDProvider ¶
type IMAPServerManager ¶
type IMAPServerManager interface { AddIMAPUser( ctx context.Context, connector connector.Connector, addrID string, idProvider GluonIDProvider, syncStateProvider syncservice.StateProvider, ) error RemoveIMAPUser(ctx context.Context, deleteData bool, provider GluonIDProvider, addrID ...string) error }
type NullIMAPServerManager ¶
type NullIMAPServerManager struct{}
func NewNullIMAPServerManager ¶
func NewNullIMAPServerManager() *NullIMAPServerManager
func (NullIMAPServerManager) AddIMAPUser ¶
func (n NullIMAPServerManager) AddIMAPUser( _ context.Context, _ connector.Connector, _ string, _ GluonIDProvider, _ syncservice.StateProvider, ) error
func (NullIMAPServerManager) RemoveIMAPUser ¶
func (n NullIMAPServerManager) RemoveIMAPUser( _ context.Context, _ bool, _ GluonIDProvider, _ ...string, ) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService( client APIClient, identityState *useridentity.State, gluonIDProvider GluonIDProvider, eventProvider EventProvider, serverManager IMAPServerManager, eventPublisher events.EventPublisher, bridgePassProvider useridentity.BridgePassProvider, keyPassProvider useridentity.KeyPassProvider, panicHandler async.PanicHandler, sendRecorder *sendrecorder.SendRecorder, telemetry Telemetry, reporter reporter.Reporter, addressMode usertypes.AddressMode, subscription events.Subscription, syncConfigDir string, maxSyncMemory uint64, showAllMail bool, observabilitySender observability.Sender, ) *Service
func (*Service) GetSyncFailedMessageIDs ¶
func (*Service) HandleAddressEvents ¶
func (*Service) HandleLabelEvents ¶
func (*Service) HandleMessageEvents ¶
func (*Service) HandleRefreshEvent ¶
func (*Service) HandleUserEvent ¶
func (*Service) SetAddressMode ¶
func (*Service) Start ¶
func (s *Service) Start( ctx context.Context, group *orderedtasks.OrderedCancelGroup, syncRegulator syncservice.Regulator, lastEventID string, ) error
type SharedCache ¶
type SharedCache struct {
// contains filtered or unexported fields
}
SharedCache is meant to protect access to the database and guarantee it's always valid. There may be some corner cases where the Gluon connector can get closed while we are processing events in parallel. If for some reason Gluon closes the database, the instance is invalidated and any attempts to access this state will return `ErrCacheNotAvailable`.
func NewSharedCached ¶
func NewSharedCached() *SharedCache
func (*SharedCache) Acquire ¶
func (s *SharedCache) Acquire() (CacheAccessor, error)
func (*SharedCache) Close ¶
func (s *SharedCache) Close()
func (*SharedCache) Set ¶
func (s *SharedCache) Set(cache connector.IMAPState)
type SyncMessageBuilder ¶
type SyncMessageBuilder struct {
// contains filtered or unexported fields
}
func NewSyncMessageBuilder ¶
func NewSyncMessageBuilder(rw *rwIdentity) *SyncMessageBuilder
func (SyncMessageBuilder) BuildMessage ¶
func (s SyncMessageBuilder) BuildMessage( apiLabels map[string]proton.Label, full proton.FullMessage, addrKR *crypto.KeyRing, buffer *bytes.Buffer, ) (syncservice.BuildResult, error)
type SyncState ¶
type SyncState struct {
// contains filtered or unexported fields
}
func NewSyncState ¶
func (*SyncState) AddFailedMessageID ¶
func (*SyncState) GetSyncStatus ¶
func (*SyncState) RemFailedMessageID ¶
func (*SyncState) SetHasMessages ¶
func (*SyncState) SetLastMessageID ¶
type SyncUpdateApplier ¶
type SyncUpdateApplier struct {
// contains filtered or unexported fields
}
func NewSyncUpdateApplier ¶
func NewSyncUpdateApplier() *SyncUpdateApplier
func (*SyncUpdateApplier) ApplySyncUpdates ¶
func (s *SyncUpdateApplier) ApplySyncUpdates(ctx context.Context, updates []syncservice.BuildResult) error
func (*SyncUpdateApplier) Close ¶
func (s *SyncUpdateApplier) Close()
func (*SyncUpdateApplier) SyncLabels ¶
func (s *SyncUpdateApplier) SyncLabels(ctx context.Context, labels map[string]proton.Label) error
func (*SyncUpdateApplier) SyncSystemLabelsOnly ¶
func (s *SyncUpdateApplier) SyncSystemLabelsOnly(ctx context.Context, labels map[string]proton.Label) error
Source Files ¶
- api_client.go
- connector.go
- helpers.go
- imap_updates.go
- server_manager.go
- service.go
- service_address_events.go
- service_label_events.go
- service_message_events.go
- service_sync_events.go
- shared_cache.go
- shared_identity.go
- shared_labels.go
- sync_build.go
- sync_message_builder.go
- sync_reporter.go
- sync_state_provider.go
- sync_update_applier.go
Directories ¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
observabilitymetrics
|
|
Click to show internal directories.
Click to hide internal directories.