Add directory replication support #738
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements directory replication support, allowing Litestream to replicate entire directories of SQLite databases. This is particularly useful for multi-tenant applications where each tenant has their own database file.
Closes #42
Features
*.db
,*.sqlite
, etc.)Configuration Example
Implementation Details
DBConfig
withDirectory
,Pattern
, andRecursive
fieldsNewDBsFromDirectoryConfig()
to create multiple DB instances from a directoryFindSQLiteDatabases()
for directory scanning with pattern matchingIsSQLiteDatabase()
for file validation via header checkReplicateCommand
to handle directory configurationsmain_test.go
Testing
go vet
passesstaticcheck
passesExample Configuration
See
etc/litestream-directory-example.yml
for comprehensive examples including multi-tenant and mixed configurations.Documentation Follow-up
A follow-up issue should be created in the litestream.io repository to document:
directory
,pattern
,recursive
)Future Enhancements
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]