partly or unimplemented features - now implemented

This commit is contained in:
master
2026-02-09 08:53:51 +02:00
parent 1bf6bbf395
commit 4bdc298ec1
674 changed files with 90194 additions and 2271 deletions

View File

@@ -496,3 +496,89 @@ DSSE envelope contains:
4. **Rotate signing keys periodically**
5. **Audit import events**
6. **Monitor for duplicate bundle imports**
## Snapshot Pinning and Rollback
> **Sprint:** SPRINT_20260208_035_Concelier_feed_snapshot_coordinator
### Overview
Snapshot pinning provides cross-instance coordination for federated deployments. It ensures that:
- All federated sites can synchronize to a common snapshot version
- Failed imports are automatically rolled back to the previous stable state
- Concurrent snapshot operations are detected and prevented
### Services
The following services are registered by `AddConcelierFederationServices()`:
| Service | Description |
|---------|-------------|
| `IFeedSnapshotPinningService` | Low-level snapshot pinning using SyncLedgerRepository |
| `ISnapshotIngestionOrchestrator` | High-level orchestration with automatic rollback |
### Automatic Rollback on Import Failure
When importing a snapshot bundle, the `ISnapshotIngestionOrchestrator` provides:
1. **Lock acquisition** - Prevents concurrent operations on the same source
2. **Conflict detection** - Checks for cursor conflicts before proceeding
3. **Pin-before-import** - Pins the snapshot ID before import begins
4. **Automatic rollback** - On import failure, automatically reverts to previous state
```csharp
// Example usage in application code
var result = await orchestrator.ImportWithRollbackAsync(
inputStream,
importOptions,
sourceId,
cancellationToken);
if (!result.Success)
{
if (result.WasRolledBack)
{
_logger.LogWarning(
"Import failed but rolled back to {SnapshotId}",
result.RolledBackToSnapshotId);
}
}
```
### API Endpoints
The snapshot pinning service is available through the existing feed snapshot endpoints:
```
POST /api/v1/feeds/snapshot/import
```
When the orchestrator is used, the response includes rollback information:
```json
{
"success": false,
"error": "Import failed: invalid bundle format",
"was_rolled_back": true,
"rolled_back_to_snapshot_id": "snapshot-2024-001"
}
```
### Configuration
Snapshot pinning uses the same `FederationOptions` as other federation features:
```yaml
Federation:
Enabled: true
SiteId: "site-us-west-1" # Required for pinning coordination
```
### Monitoring
Key metrics for snapshot pinning:
- `snapshot_pin_success_total` - Successful pin operations
- `snapshot_pin_failure_total` - Failed pin operations
- `snapshot_rollback_total` - Rollback operations triggered
- `snapshot_conflict_total` - Conflict detections