Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
marchi
command
Command marchi is the single-binary entry point for the Marchi email archiving service.
|
Command marchi is the single-binary entry point for the Marchi email archiving service. |
|
internal
|
|
|
account
Package account is the Account Manager (FR-AM-01..06): the business-logic layer between the CLI/HTTP handlers and repo.AccountsRepo.
|
Package account is the Account Manager (FR-AM-01..06): the business-logic layer between the CLI/HTTP handlers and repo.AccountsRepo. |
|
backup
Package backup produces a consistent, hot (no-downtime) snapshot of everything needed to restore a Marchi archive elsewhere: the SQLite database (via SQLite's Online Backup API, not a raw file copy — the database is live and under WAL, so copying the file directly could catch it mid-write), the Maildir tree, and the Master Key's wrapped key material (.salt/.mk-verify/.dek).
|
Package backup produces a consistent, hot (no-downtime) snapshot of everything needed to restore a Marchi archive elsewhere: the SQLite database (via SQLite's Online Backup API, not a raw file copy — the database is live and under WAL, so copying the file directly could catch it mid-write), the Maildir tree, and the Master Key's wrapped key material (.salt/.mk-verify/.dek). |
|
config
Package config loads Marchi's configuration from config.yaml, layering environment variable overrides on top per NFR-DP-03 (env wins over YAML).
|
Package config loads Marchi's configuration from config.yaml, layering environment variable overrides on top per NFR-DP-03 (env wins over YAML). |
|
db
Package db opens the SQLite database (FR-ST-02: WAL mode, the only database Marchi uses) and applies embedded schema migrations.
|
Package db opens the SQLite database (FR-ST-02: WAL mode, the only database Marchi uses) and applies embedded schema migrations. |
|
db/migrations
Package migrations embeds the SQLite schema migrations into the binary (FR-DP-01: single binary, no external files needed at runtime).
|
Package migrations embeds the SQLite schema migrations into the binary (FR-DP-01: single binary, no external files needed at runtime). |
|
db/repo
Package repo holds per-table data access: reads go straight against the pooled *sql.DB (WAL allows concurrent readers), writes go through writer.Writer so every mutation is serialized through the Single Writer Pattern (FR-ST-02).
|
Package repo holds per-table data access: reads go straight against the pooled *sql.DB (WAL allows concurrent readers), writes go through writer.Writer so every mutation is serialized through the Single Writer Pattern (FR-ST-02). |
|
db/writer
Package writer implements the Single Writer Pattern (FR-ST-02): every INSERT/UPDATE/DELETE against SQLite goes through one goroutine and one channel, so concurrent Sync Engine/S3 uploader/Rule Engine components never contend on WAL writer locks or deadlock against each other.
|
Package writer implements the Single Writer Pattern (FR-ST-02): every INSERT/UPDATE/DELETE against SQLite goes through one goroutine and one channel, so concurrent Sync Engine/S3 uploader/Rule Engine components never contend on WAL writer locks or deadlock against each other. |
|
domain
Package domain holds plain data structs shared across packages (Account, and more as later steps add Folder/Email/Attachment/Rule/...).
|
Package domain holds plain data structs shared across packages (Account, and more as later steps add Folder/Email/Attachment/Rule/...). |
|
gmailapi
Package gmailapi is a hand-rolled client for the handful of Gmail REST API v1 endpoints the Gmail connector needs (internal/sync's SyncAccountGmailAPI): listing/fetching messages, delta sync via the History API, and label/trash mutations for rule actions.
|
Package gmailapi is a hand-rolled client for the handful of Gmail REST API v1 endpoints the Gmail connector needs (internal/sync's SyncAccountGmailAPI): listing/fetching messages, delta sync via the History API, and label/trash mutations for rule actions. |
|
httpapi
Package httpapi is Marchi's HTTP server (FR-WU-*, FR-API-*): the long-running Fiber process that, unlike Phase 1's one-shot CLI commands, stays up across many requests and starts in a locked state until the Master Key is supplied (see the unlock-gate added in a later step).
|
Package httpapi is Marchi's HTTP server (FR-WU-*, FR-API-*): the long-running Fiber process that, unlike Phase 1's one-shot CLI commands, stays up across many requests and starts in a locked state until the Master Key is supplied (see the unlock-gate added in a later step). |
|
i18n
Package i18n resolves Marchi's UI language (ru/en, FR-WU-*) and looks up translated strings for both the Web UI (per-request) and the CLI (once, at process startup).
|
Package i18n resolves Marchi's UI language (ru/en, FR-WU-*) and looks up translated strings for both the Web UI (per-request) and the CLI (once, at process startup). |
|
imapclient
Package imapclient wraps emersion/go-imap's client for Marchi's Account Manager and Sync Engine: connecting with a chosen TLS mode, logging in, and classifying failures into stages.
|
Package imapclient wraps emersion/go-imap's client for Marchi's Account Manager and Sync Engine: connecting with a chosen TLS mode, logging in, and classifying failures into stages. |
|
importer
Package importer reads already-exported mail out of three common offline formats — mbox, Maildir, and a directory of loose .eml files — and hands each message's raw RFC 5322 bytes to a callback.
|
Package importer reads already-exported mail out of three common offline formats — mbox, Maildir, and a directory of loose .eml files — and hands each message's raw RFC 5322 bytes to a callback. |
|
logging
Package logging wires uber-go/zap to a daily-rotating file sink per NFR-RL-04: {data_dir}/logs/marchi-{YYYY-MM-DD}.log, 30-day retention, 100MB max file size — and, by default, a second console sink alongside it (see Options.Output's doc comment for why both are on by default, and why that sink is stderr despite being called "stdout").
|
Package logging wires uber-go/zap to a daily-rotating file sink per NFR-RL-04: {data_dir}/logs/marchi-{YYYY-MM-DD}.log, 30-day retention, 100MB max file size — and, by default, a second console sink alongside it (see Options.Output's doc comment for why both are on by default, and why that sink is stderr despite being called "stdout"). |
|
maildir
Package maildir writes archived emails to disk in Maildir format (FR-ST-01): {data_dir}/accounts/{account_id}/mail/{folder_safe_name}/{cur,new,tmp}/, one file per message, filenames per the Maildir spec.
|
Package maildir writes archived emails to disk in Maildir format (FR-ST-01): {data_dir}/accounts/{account_id}/mail/{folder_safe_name}/{cur,new,tmp}/, one file per message, filenames per the Maildir spec. |
|
mimeparse
Package mimeparse extracts archival metadata — Message-ID, Subject, From, To, Cc, Date — from a raw RFC 5322 message, via emersion/go-message.
|
Package mimeparse extracts archival metadata — Message-ID, Subject, From, To, Cc, Date — from a raw RFC 5322 message, via emersion/go-message. |
|
msgraph
Package msgraph is a hand-rolled client for the handful of Microsoft Graph REST API v1.0 endpoints the MS Graph connector needs (internal/sync's SyncAccountMSGraph): listing mail folders, delta-syncing messages within a folder, fetching raw MIME content, and marking read/deleting for rule actions.
|
Package msgraph is a hand-rolled client for the handful of Microsoft Graph REST API v1.0 endpoints the MS Graph connector needs (internal/sync's SyncAccountMSGraph): listing mail folders, delta-syncing messages within a folder, fetching raw MIME content, and marking read/deleting for rule actions. |
|
notify
Package notify sends failure notifications through independent channels (webhook, email) so a background sync/retention failure, an S3 upload backlog, or low disk space doesn't sit silently until someone happens to open the Web UI.
|
Package notify sends failure notifications through independent channels (webhook, email) so a background sync/retention failure, an S3 upload backlog, or low disk space doesn't sit silently until someone happens to open the Web UI. |
|
notifyconfig
Package notifyconfig is the Notification Settings Manager (Phase 5 P0-2): the business-logic layer between the HTTP API and repo.NotificationSettingsRepo, mirroring internal/s3config's role for S3 credentials.
|
Package notifyconfig is the Notification Settings Manager (Phase 5 P0-2): the business-logic layer between the HTTP API and repo.NotificationSettingsRepo, mirroring internal/s3config's role for S3 credentials. |
|
oauth2
Package oauth2 implements FR-AM-01's OAuth2 accounts (Google and Microsoft): the BYO-app authorization-code exchange, refresh, and the SASL XOAUTH2 initial-response encoding IMAP and SMTP both use to authenticate with a bearer token instead of a plain password.
|
Package oauth2 implements FR-AM-01's OAuth2 accounts (Google and Microsoft): the BYO-app authorization-code exchange, refresh, and the SASL XOAUTH2 initial-response encoding IMAP and SMTP both use to authenticate with a bearer token instead of a plain password. |
|
oauth2config
Package oauth2config is the OAuth2 BYO App Settings Manager (поправка #4, Phase 3 step 13): the business-logic layer between the HTTP API and repo.OAuth2AppsRepo, mirroring internal/s3config's role for S3 connection settings and internal/account's for IMAP credentials.
|
Package oauth2config is the OAuth2 BYO App Settings Manager (поправка #4, Phase 3 step 13): the business-logic layer between the HTTP API and repo.OAuth2AppsRepo, mirroring internal/s3config's role for S3 connection settings and internal/account's for IMAP credentials. |
|
reindex
Package reindex implements FR-SR-04: wiping and rebuilding the search index from the local .eml archive — the recovery path whenever the index falls out of sync with the archive (best-effort indexing failures during sync, per internal/sync's archiveOne, or restoring from a backup that didn't include the index, since FR-SR-01 never replicates it).
|
Package reindex implements FR-SR-04: wiping and rebuilding the search index from the local .eml archive — the recovery path whenever the index falls out of sync with the archive (best-effort indexing failures during sync, per internal/sync's archiveOne, or restoring from a backup that didn't include the index, since FR-SR-01 never replicates it). |
|
restore
Package restore implements the Restore Engine (FR-RS-01..05): copying an archived email back into a live IMAP mailbox.
|
Package restore implements the Restore Engine (FR-RS-01..05): copying an archived email back into a live IMAP mailbox. |
|
retention
Package retention implements FR-RE-04's cron-driven archive lifecycle: a three-stage model per email —
|
Package retention implements FR-RE-04's cron-driven archive lifecycle: a three-stage model per email — |
|
rules
Package rules evaluates archive rules (FR-RE-01..03) against a message fetched but not yet archived.
|
Package rules evaluates archive rules (FR-RE-01..03) against a message fetched but not yet archived. |
|
s3config
Package s3config is the S3 Settings Manager (FR-S3-02, Phase 3 step 9): the business-logic layer between the HTTP API and repo.S3ConfigRepo, mirroring internal/account's role for IMAP credentials.
|
Package s3config is the S3 Settings Manager (FR-S3-02, Phase 3 step 9): the business-logic layer between the HTTP API and repo.S3ConfigRepo, mirroring internal/account's role for IMAP credentials. |
|
s3store
Package s3store implements the S3 mirror/disaster-recovery layer (FR-S3-01 through FR-S3-09): a client wrapping aws-sdk-go-v2 for MinIO-compatible endpoints, the FR-S3-04 object key layout, and (in later Phase 3 steps) client-side encryption and an upload queue worker pool.
|
Package s3store implements the S3 mirror/disaster-recovery layer (FR-S3-01 through FR-S3-09): a client wrapping aws-sdk-go-v2 for MinIO-compatible endpoints, the FR-S3-04 object key layout, and (in later Phase 3 steps) client-side encryption and an upload queue worker pool. |
|
scheduler
Package scheduler implements FR-SE-06: background sync on a per-account cron schedule, with bounded concurrency across accounts.
|
Package scheduler implements FR-SE-06: background sync on a per-account cron schedule, with bounded concurrency across accounts. |
|
search
Package search wraps Bluge, Marchi's full-text search engine (FR-SR-01..04).
|
Package search wraps Bluge, Marchi's full-text search engine (FR-SR-01..04). |
|
security/crypto
Package crypto provides the AES-256-GCM encryption and HKDF subkey derivation primitives used throughout Marchi: encrypting IMAP passwords/OAuth2 tokens/S3 credentials before they touch SQLite, and client-side encrypting .eml files before they're uploaded to S3.
|
Package crypto provides the AES-256-GCM encryption and HKDF subkey derivation primitives used throughout Marchi: encrypting IMAP passwords/OAuth2 tokens/S3 credentials before they touch SQLite, and client-side encrypting .eml files before they're uploaded to S3. |
|
security/masterkey
Package masterkey implements FR-ST-04 / NFR-SC-01: deriving the Master Key from a user password via Argon2id, and verifying a password against a previously-bootstrapped vault without ever persisting the key itself.
|
Package masterkey implements FR-ST-04 / NFR-SC-01: deriving the Master Key from a user password via Argon2id, and verifying a password against a previously-bootstrapped vault without ever persisting the key itself. |
|
sync
Package sync is the Sync Engine: orchestrating IMAP folder/UID bookkeeping (this step) and, from a later step, incremental message fetch and archiving.
|
Package sync is the Sync Engine: orchestrating IMAP folder/UID bookkeeping (this step) and, from a later step, incremental message fetch and archiving. |
|
testutil/dovecot
Package dovecot is a reusable test harness that runs a real dovecot/dovecot:latest container for integration tests that need an actual IMAP server rather than the in-process fake servers internal/imapclient and internal/sync's own unit tests use for deterministic, Docker-free coverage of protocol edge cases.
|
Package dovecot is a reusable test harness that runs a real dovecot/dovecot:latest container for integration tests that need an actual IMAP server rather than the in-process fake servers internal/imapclient and internal/sync's own unit tests use for deterministic, Docker-free coverage of protocol edge cases. |
|
testutil/minio
Package minio is a reusable test harness that runs a real minio/minio container for integration tests that need an actual S3-compatible server, mirroring internal/testutil/dovecot's pattern for IMAP.
|
Package minio is a reusable test harness that runs a real minio/minio container for integration tests that need an actual S3-compatible server, mirroring internal/testutil/dovecot's pattern for IMAP. |
|
version
Package version holds build metadata injected via -ldflags at release build time.
|
Package version holds build metadata injected via -ldflags at release build time. |
|
webui
Package webui parses Marchi's embedded html/template sources and exposes its embedded static assets (Tailwind CSS, self-hosted HTMX).
|
Package webui parses Marchi's embedded html/template sources and exposes its embedded static assets (Tailwind CSS, self-hosted HTMX). |
|
Package web embeds Marchi's html/template sources, Tailwind-built CSS, and self-hosted HTMX so the server ships as a single binary with no runtime dependency on Node.js, a CDN, or a filesystem checkout (NFR-DP-02).
|
Package web embeds Marchi's html/template sources, Tailwind-built CSS, and self-hosted HTMX so the server ships as a single binary with no runtime dependency on Node.js, a CDN, or a filesystem checkout (NFR-DP-02). |
Click to show internal directories.
Click to hide internal directories.