This document describes the Directed Acyclic Graph (DAG) representing the dependencies and data flow in Vectorizer Sync. The DAG shows how components interact and the order of operations.
┌─────────────────────────────────────────────────────────────────┐
│ Application Entry │
│ (main/index.ts) │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌────────────────┐
│ Database │
│ Manager │
│ (init) │
└────────┬───────┘
│
▼
┌────────────────┐
│ User Settings │
│ (load) │
└────────┬───────┘
│
▼
┌────────────────┐
│ UI Renderer │
│ (React App) │
└────────┬───────┘
│
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Project │ │ Workspace │ │ Sync │
│ Manager │ │ Exporter │ │ Manager │
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
│ │ │
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Database │ │ File │ │ File │
│ (projects) │ │ Scanner │ │ Watcher │
└───────────────┘ └───────┬───────┘ └───────┬───────┘
│ │
└─────────┬─────────┘
│
▼
┌─────────────────┐
│ File Filter │
└────────┬────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Workspace │ │ File │ │ HiveHub │
│ Generator │ │ Metadata │ │ API Client │
└──────────────┘ └───────┬──────┘ └───────┬──────┘
│ │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Database │
│ (file_metadata)│
└─────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ File System Event │
│ (create, modify, delete) │
└────────────────────────┬────────────────────────────────────┘
│
▼
┌────────────────┐
│ File Watcher │
│ (chokidar) │
└────────┬───────┘
│
▼
┌────────────────┐
│ Event Queue │
│ (debounced) │
└────────┬───────┘
│
▼
┌────────────────┐
│ File Filter │
│ (exclusions) │
└────────┬───────┘
│
┌────────────┴────────────┐
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ Excluded │ │ Included │
│ (skip) │ │ (process) │
└───────────────┘ └───────┬───────┘
│
▼
┌────────────────┐
│ Hash │
│ Calculator │
└───────┬────────┘
│
┌───────────────┼───────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ New File │ │ Modified │ │ Deleted │
│ (upload) │ │ (update) │ │ (delete) │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────┼─────────────────┘
│
▼
┌────────────────┐
│ Sync Queue │
│ (prioritized) │
└───────┬────────┘
│
▼
┌────────────────┐
│ Quota Check │
└───────┬────────┘
│
┌───────────────┴───────────────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Quota OK │ │ Quota │
│ (proceed) │ │ Exceeded │
└──────┬───────┘ │ (block) │
│ └─────────────┘
▼
┌────────────────┐
│ HiveHub API │
│ (upload/update)│
└───────┬────────┘
│
┌───────────┼───────────┐
│ │ │
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ Success │ │ Partial │ │ Failed │
│ (update │ │ (retry) │ │ (log) │
│ metadata)│ │ │ │ │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
└─────────────┼─────────────┘
│
▼
┌────────────────┐
│ Database │
│ (update sync │
│ history) │
└────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ User Action: Export │
│ Workspace.yml │
└────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────┐
│ Project │
│ Selection │
└────────┬────────┘
│
▼
┌─────────────────┐
│ File Scanner │
│ (recursive) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ File Filter │
│ (exclusions) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Collection │
│ Grouping │
└────────┬────────┘
│
┌─────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Source Code │ │ Docs │ │ Config │
│ Collection │ │ Collection │ │ Collection │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────┼─────────────────┘
│
▼
┌─────────────────┐
│ Pattern │
│ Matching │
└────────┬─────────┘
│
▼
┌─────────────────┐
│ YAML Generator │
│ (workspace.yml) │
└────────┬─────────┘
│
▼
┌─────────────────┐
│ File Writer │
│ (save to disk) │
└────────┬─────────┘
│
▼
┌─────────────────┐
│ Database │
│ (save config) │
└─────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Database Operation │
└────────────────────────┬──────────────────────────────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Read │ │ Write │ │ Transaction│
│ Operation │ │ Operation │ │ Operation │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Prepared │ │ Prepared │ │ Begin │
│ Statement │ │ Statement │ │ Transaction │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Execute │ │ Execute │ │ Execute │
│ Query │ │ Query │ │ Operations │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
│ │ │
└─────────────────┼─────────────────┘
│
▼
┌─────────────────┐
│ Result │
│ Processing │
└────────┬────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Return │ │ Update │ │ Commit/ │
│ Data │ │ Cache │ │ Rollback │
└──────────────┘ └──────────────┘ └──────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Notification Source │
└────────────────────────┬──────────────────────────────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Internal │ │ HiveHub │ │ System │
│ Event │ │ API │ │ Event │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────┼─────────────────┘
│
▼
┌─────────────────┐
│ Notification │
│ Processor │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Severity │
│ Check │
└────────┬────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Info │ │ Warning │ │ Error │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────┼─────────────────┘
│
▼
┌─────────────────┐
│ Database │
│ (store) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Notification │
│ Dispatcher │
└────────┬────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ UI │ │ System Tray │ │ Sound │
│ Notification│ │ Badge │ │ Alert │
│ Center │ │ │ │ (optional) │
└──────────────┘ └──────────────┘ └──────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Application Start │
└────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────┐
│ Initialize │
│ Electron │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Check Database │
│ Directory │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Initialize │
│ Database │
│ (schema) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Load User │
│ Settings │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Load Projects │
│ from Database │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Initialize │
│ File Watchers │
│ (if enabled) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Initialize │
│ HiveHub API │
│ (if configured)│
└────────┬────────┘
│
▼
┌─────────────────┐
│ Create Browser │
│ Window │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Load React App │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Application │
│ Ready │
└─────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Sync Trigger │
│ (manual, auto, file change) │
└────────────────────────┬──────────────────────────────────┘
│
▼
┌─────────────────┐
│ Validate │
│ Project │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Check Sync │
│ Enabled │
└────────┬────────┘
│
┌────────────────┴────────────────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Disabled │ │ Enabled │
│ (skip) │ │ (proceed) │
└──────────────┘ └──────┬───────┘
│
▼
┌─────────────────┐
│ Create Sync │
│ History Entry │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Scan Files │
│ (if needed) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Compare with │
│ Metadata │
└────────┬────────┘
│
┌───────────────────────────────┼───────────────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ New Files │ │ Modified │ │ Deleted │
│ (upload) │ │ Files │ │ Files │
│ │ │ (update) │ │ (delete) │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└─────────────────────────────┼─────────────────────────────┘
│
▼
┌─────────────────┐
│ Batch │
│ Operations │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Process Queue │
│ (with retry) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Update │
│ Metadata │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Update Sync │
│ History │
└─────────────────┘
All DAGs in the system are acyclic, meaning:
- No circular dependencies between components
- Operations flow in one direction
- No infinite loops in processing
Operations follow a topological order:
- Initialization: Database → Settings → Projects
- File Processing: Scan → Filter → Process → Store
- Sync Operations: Validate → Check → Process → Update
The following operations can be parallelized:
- File scanning (multiple directories)
- File filtering (independent files)
- File hash calculation (independent files)
- Database queries (read operations)
- API requests (independent operations)
The critical path for sync operations:
File Change → Watcher → Filter → Hash → Queue → Quota Check → API → Database Update
Components are initialized in dependency order:
- Database (no dependencies)
- Settings (depends on Database)
- File Scanner (depends on Settings)
- File Watcher (depends on Scanner)
- Sync Engine (depends on Watcher, API)
- UI (depends on all above)
Errors propagate through the DAG:
- Component errors are caught and logged
- Failed operations are retried (with backoff)
- Critical errors stop the operation flow
- Non-critical errors allow partial success
- Batching: Group operations to reduce overhead
- Caching: Cache results to avoid recomputation
- Lazy Loading: Load data only when needed
- Debouncing: Batch rapid file changes
The DAG can be visualized using:
- Graphviz: Generate visual representations
- Mermaid: Render in markdown
- D3.js: Interactive visualization
- Cytoscape: Network analysis
digraph SyncFlow {
FileChange -> FileWatcher
FileWatcher -> EventQueue
EventQueue -> FileFilter
FileFilter -> HashCalculator
HashCalculator -> SyncQueue
SyncQueue -> QuotaCheck
QuotaCheck -> HiveHubAPI
HiveHubAPI -> DatabaseUpdate
}