sync

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package sync provides Gmail synchronization workflows.

Index

Constants

This section is empty.

Variables

View Source
var ErrHistoryExpired = errors.New("history expired - run full sync")

ErrHistoryExpired indicates that the Gmail history ID is too old and a full sync is required.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Query is an optional Gmail search query (e.g., "before:2020/01/01")
	Query string

	// NoResume forces a fresh sync even if a checkpoint exists
	NoResume bool

	// BatchSize is the number of messages to fetch in parallel (default: 10)
	BatchSize int

	// CheckpointInterval is how often to save progress (default: every 200 messages)
	CheckpointInterval int

	// AttachmentsDir is where to store attachments
	AttachmentsDir string
}

Options configures sync behavior.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns sensible defaults.

type Syncer

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

Syncer performs Gmail synchronization.

func New

func New(client gmail.API, store *store.Store, opts *Options) *Syncer

New creates a new Syncer.

func (*Syncer) Full

func (s *Syncer) Full(ctx context.Context, email string) (*gmail.SyncSummary, error)

Full performs a full synchronization.

func (*Syncer) Incremental

func (s *Syncer) Incremental(ctx context.Context, email string) (*gmail.SyncSummary, error)

Incremental performs an incremental sync using the Gmail History API. Falls back to full sync if history is too old (404 error).

func (*Syncer) WithLogger

func (s *Syncer) WithLogger(logger *slog.Logger) *Syncer

WithLogger sets the logger.

func (*Syncer) WithProgress

func (s *Syncer) WithProgress(p gmail.SyncProgress) *Syncer

WithProgress sets the progress reporter.

Jump to

Keyboard shortcuts

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