Documentation
¶
Index ¶
- type Checkpoint
- type InboxConfig
- type MailProvider
- type Manager
- func (m *Manager) GetRunningSyncs() []string
- func (m *Manager) IsRunning(userID, inboxID string, provider ProviderName) bool
- func (m *Manager) StartSync(ctx context.Context, config InboxConfig) error
- func (m *Manager) StopAll()
- func (m *Manager) StopSync(userID, inboxID string, provider ProviderName) error
- type MessageMeta
- type ProviderFactory
- type ProviderName
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
// Gmail: LastHistoryID; Outlook: DeltaLink (cursor)
Cursor string
}
Checkpoint represents sync state for a provider
type InboxConfig ¶
type InboxConfig struct {
UserID string
InboxID string
Provider ProviderName
UserJWT string // JWT to fetch tokens from BetterAuth
}
InboxConfig config for user inbox sync
type MailProvider ¶
type MailProvider interface {
// InitialBackfill performs full import or deep backfill window
InitialBackfill(ctx context.Context, user string, cp *Checkpoint, fn func(MessageMeta) error) (*Checkpoint, error)
// IncrementalSync performs incremental sync from a checkpoint
IncrementalSync(ctx context.Context, user string, cp Checkpoint, fn func(MessageMeta) error) (*Checkpoint, error)
}
MailProvider interface for provider-agnostic mail sync
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multi-user sync workers
func NewManager ¶
func NewManager(dataRoot string, authClient *auth.BetterAuthClient, publisher *natsjs.Publisher, providerFactory ProviderFactory) *Manager
NewManager creates sync manager
func (*Manager) GetRunningSyncs ¶
GetRunningSyncs returns list of currently running syncs
func (*Manager) IsRunning ¶
func (m *Manager) IsRunning(userID, inboxID string, provider ProviderName) bool
IsRunning checks if sync is running for a user inbox
type MessageMeta ¶
type MessageMeta struct {
Provider ProviderName
UserID string
InboxID string
MessageID string // provider ID (Gmail: Id, Outlook: id)
ThreadID string // provider thread/conversation id
Subject string
Sender string
To []string
Cc []string
Bcc []string
Snippet string
ProviderLabels []string
Headers map[string]string
MessageDate time.Time
}
MessageMeta represents normalized email metadata across providers
type ProviderFactory ¶
type ProviderFactory func(ctx context.Context, token *auth.Token, userID string, provider ProviderName) (MailProvider, error)
ProviderFactory creates MailProvider
type ProviderName ¶
type ProviderName string
ProviderName represents email provider types
const ( ProviderGoogle ProviderName = "GOOGLE" ProviderMicrosoft ProviderName = "MICROSOFT" )
type Runner ¶
type Runner struct {
DataRoot string
AuthClient *auth.BetterAuthClient
UserJWT string
Publisher *natsjs.Publisher
Provider MailProvider
ProviderName ProviderName
}
Runner orchestrates mail sync for user inbox
Click to show internal directories.
Click to hide internal directories.