Implement local SQLite index database with repositories

- Add SQLite database connection management with proper error handling
- Implement schema for files, chunks, blobs, and snapshots tables
- Create repository pattern for each database table
- Add transaction support with proper rollback handling
- Integrate database module with fx dependency injection
- Make index path configurable via VAULTIK_INDEX_PATH env var
- Add fatal error handling for database integrity issues
- Update DESIGN.md to clarify file_chunks vs chunk_files distinction
- Remove FinalHash from BlobInfo (blobs are content-addressable)
- Add file metadata support (mtime, ctime, mode, uid, gid, symlinks)
This commit is contained in:
2025-07-20 10:26:15 +02:00
parent 9de439a0a4
commit b2e85d9e76
31 changed files with 1229 additions and 83 deletions

View File

@@ -78,6 +78,11 @@ func Load(path string) (*Config, error) {
return nil, fmt.Errorf("failed to parse config: %w", err)
}
// Check for environment variable override for IndexPath
if envIndexPath := os.Getenv("VAULTIK_INDEX_PATH"); envIndexPath != "" {
cfg.IndexPath = envIndexPath
}
// Get hostname if not set
if cfg.Hostname == "" {
hostname, err := os.Hostname()
@@ -146,4 +151,4 @@ func (c *Config) Validate() error {
// Module exports the config module for fx
var Module = fx.Module("config",
fx.Provide(New),
)
)