Skip to content

Add file/directory watcher support for directory replication #818

@corylanou

Description

@corylanou

PR #738 added directory replication functionality that allows Litestream to replicate all SQLite databases found within a directory structure. Currently, this only picks up databases that exist when Litestream starts.

The next enhancement is to add file/directory watcher support so that:

  1. New databases are automatically detected when they're created in the watched directory after Litestream has started
  2. Deleted databases are removed from replication when they're deleted from the filesystem
  3. The system automatically adapts to changes in the directory structure without requiring a restart

Implementation Considerations

  • Use appropriate file system watcher for cross-platform support (e.g., fsnotify)
  • Handle edge cases like temporary files, partially-written databases, and rapid create/delete cycles
  • Consider performance implications for directories with many databases
  • Maintain thread safety when adding/removing database monitors
  • Log clear messages when databases are added to or removed from replication

Related Work

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions