Caldav unidirectional design
This commit is contained in:
parent
004d272ef9
commit
9a21263738
1 changed files with 158 additions and 15 deletions
173
DEVELOPMENT.md
173
DEVELOPMENT.md
|
|
@ -376,25 +376,29 @@ pub async fn fetch_events(&self, calendar: &CalendarInfo) -> CalDavResult<Vec<Ev
|
|||
|
||||
## Future Enhancements
|
||||
|
||||
### 1. **Enhanced Filtering**
|
||||
### 1. **Event Import to Target Servers**
|
||||
- **Unidirectional Import**: Import events from source CalDAV server to target (e.g., Zoho → Nextcloud)
|
||||
- **Source of Truth**: Source server always wins - target events are overwritten/updated based on source
|
||||
- **Dual Client Architecture**: Support for simultaneous source and target CalDAV connections
|
||||
- **Target Calendar Validation**: Verify target calendar exists, fail if not found (auto-creation as future enhancement)
|
||||
|
||||
### 2. **Enhanced Filtering**
|
||||
- Advanced regex patterns
|
||||
- Calendar color-based filtering
|
||||
- Attendee-based filtering
|
||||
|
||||
### 2. **Bidirectional Sync**
|
||||
- Two-way synchronization with conflict resolution
|
||||
- Event modification tracking
|
||||
- Deletion synchronization
|
||||
- Import-specific filtering rules
|
||||
|
||||
### 3. **Performance Optimizations**
|
||||
- Batch import operations for large calendars
|
||||
- Parallel calendar processing
|
||||
- Incremental sync with change detection
|
||||
- Local caching and offline mode
|
||||
|
||||
### 4. **User Experience**
|
||||
- Interactive configuration wizard
|
||||
- Interactive configuration wizard for source/target setup
|
||||
- Dry-run mode for import preview
|
||||
- Web-based status dashboard
|
||||
- Real-time sync notifications
|
||||
- Real-time import progress notifications
|
||||
|
||||
## Implementation Summary
|
||||
|
||||
|
|
@ -481,14 +485,153 @@ cargo run -- --list-calendars
|
|||
cargo run -- --list-events --approach report-simple
|
||||
```
|
||||
|
||||
### 📈 **Future Enhancements Available**
|
||||
### 📈 **Nextcloud Event Import Development Plan**
|
||||
|
||||
The architecture is ready for:
|
||||
1. **Bidirectional Sync**: Two-way synchronization with conflict resolution
|
||||
2. **Multiple Calendar Support**: Sync multiple calendars simultaneously
|
||||
3. **Enhanced Filtering**: Advanced regex and attendee-based filtering
|
||||
4. **Performance Optimizations**: Parallel processing and incremental sync
|
||||
5. **Web Interface**: Interactive configuration and status dashboard
|
||||
The architecture is ready for the next major feature: **Unidirectional Event Import** from source CalDAV server (e.g., Zoho) to target server (e.g., Nextcloud).
|
||||
|
||||
#### **Import Architecture Overview**
|
||||
```
|
||||
Source Server (Zoho) ──→ Target Server (Nextcloud)
|
||||
↑ ↓
|
||||
Source of Truth Import Destination
|
||||
```
|
||||
|
||||
#### **Implementation Plan (3 Phases)**
|
||||
|
||||
**Phase 1: Core Infrastructure (2-3 days)**
|
||||
1. **Configuration Restructuring**
|
||||
```rust
|
||||
pub struct Config {
|
||||
pub source: ServerConfig, // Source server (Zoho)
|
||||
pub target: ServerConfig, // Target server (Nextcloud)
|
||||
pub source_calendar: CalendarConfig,
|
||||
pub target_calendar: CalendarConfig,
|
||||
pub import: ImportConfig, // Import-specific settings
|
||||
}
|
||||
```
|
||||
|
||||
2. **Dual Client Support**
|
||||
```rust
|
||||
pub struct SyncEngine {
|
||||
pub source_client: RealCalDavClient, // Source server
|
||||
pub target_client: RealCalDavClient, // Target server
|
||||
import_state: ImportState, // Track imported events
|
||||
}
|
||||
```
|
||||
|
||||
3. **Import State Tracking**
|
||||
```rust
|
||||
pub struct ImportState {
|
||||
pub last_import: Option<DateTime<Utc>>,
|
||||
pub imported_events: HashMap<String, String>, // source_uid → target_href
|
||||
pub deleted_events: HashSet<String>, // Deleted source events
|
||||
}
|
||||
```
|
||||
|
||||
**Phase 2: Import Logic (2-3 days)**
|
||||
1. **Import Pipeline Algorithm**
|
||||
```rust
|
||||
async fn import_events(&mut self) -> Result<ImportResult> {
|
||||
// 1. Fetch source events
|
||||
let source_events = self.source_client.get_events(...).await?;
|
||||
|
||||
// 2. Fetch target events
|
||||
let target_events = self.target_client.get_events(...).await?;
|
||||
|
||||
// 3. Process each source event (source wins)
|
||||
for source_event in source_events {
|
||||
if let Some(target_href) = self.import_state.imported_events.get(&source_event.uid) {
|
||||
// UPDATE: Overwrite target with source data
|
||||
self.update_target_event(source_event, target_href).await?;
|
||||
} else {
|
||||
// CREATE: New event in target
|
||||
self.create_target_event(source_event).await?;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. DELETE: Remove orphaned target events
|
||||
self.delete_orphaned_events(source_events, target_events).await?;
|
||||
}
|
||||
```
|
||||
|
||||
2. **Target Calendar Management**
|
||||
- Validate target calendar exists before import
|
||||
- Set calendar properties (color, name, timezone)
|
||||
- Fail fast if target calendar is not found
|
||||
- Auto-creation as future enhancement (nice-to-have)
|
||||
|
||||
3. **Event Transformation**
|
||||
- Convert between iCalendar formats if needed
|
||||
- Preserve timezone information
|
||||
- Handle UID mapping for future updates
|
||||
|
||||
**Phase 3: CLI & User Experience (1-2 days)**
|
||||
1. **Import Commands**
|
||||
```bash
|
||||
# Import events (dry run by default)
|
||||
cargo run -- --import-events --dry-run
|
||||
|
||||
# Execute actual import
|
||||
cargo run -- --import-events --target-calendar "Imported-Zoho-Events"
|
||||
|
||||
# List import status
|
||||
cargo run -- --import-status
|
||||
```
|
||||
|
||||
2. **Progress Reporting**
|
||||
- Real-time import progress
|
||||
- Summary statistics (created/updated/deleted)
|
||||
- Error reporting and recovery
|
||||
|
||||
3. **Configuration Examples**
|
||||
```toml
|
||||
[source]
|
||||
server_url = "https://caldav.zoho.com/caldav"
|
||||
username = "user@zoho.com"
|
||||
password = "zoho-app-password"
|
||||
|
||||
[target]
|
||||
server_url = "https://nextcloud.example.com"
|
||||
username = "nextcloud-user"
|
||||
password = "nextcloud-app-password"
|
||||
|
||||
[source_calendar]
|
||||
name = "Work Calendar"
|
||||
|
||||
[target_calendar]
|
||||
name = "Imported-Work-Events"
|
||||
create_if_missing = true
|
||||
color = "#3174ad"
|
||||
|
||||
[import]
|
||||
overwrite_existing = true # Source always wins
|
||||
delete_missing = true # Remove events not in source
|
||||
dry_run = false
|
||||
batch_size = 50
|
||||
```
|
||||
|
||||
#### **Key Implementation Principles**
|
||||
|
||||
1. **Source is Always Truth**: Source server data overwrites target
|
||||
2. **Unidirectional Flow**: No bidirectional sync complexity
|
||||
3. **Robust Error Handling**: Continue import even if some events fail
|
||||
4. **Progress Visibility**: Clear reporting of import operations
|
||||
5. **Configuration Flexibility**: Support for any CalDAV source/target
|
||||
|
||||
#### **Estimated Timeline**
|
||||
- **Phase 1**: 2-3 days (Core infrastructure)
|
||||
- **Phase 2**: 2-3 days (Import logic)
|
||||
- **Phase 3**: 1-2 days (CLI & UX)
|
||||
- **Total**: 5-8 days for complete implementation
|
||||
|
||||
#### **Success Criteria**
|
||||
- Successfully import events from Zoho to Nextcloud
|
||||
- Handle timezone preservation during import
|
||||
- Provide clear progress reporting
|
||||
- Support dry-run mode for preview
|
||||
- Handle large calendars (1000+ events) efficiently
|
||||
|
||||
This plan provides a clear roadmap for implementing the unidirectional event import feature while maintaining the simplicity and reliability of the current codebase.
|
||||
|
||||
### 🎉 **Final Status**
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue