Metadata Cleanup
The Metadata Cleanup project (Alert.CA.MetadataCleanup) is an Azure Functions v4 app that periodically purges expired image metadata from Table Storage. Without this service, metadata would accumulate indefinitely as cameras continuously capture images.
Architectureβ
How It Worksβ
Step 1: Timer Enqueueβ
A timer-triggered function runs on a configured schedule and enqueues device IDs to three separate cleanup queues β one per image type.
Step 2: Queue Processingβ
Three independent queue processors run in parallel:
- Single image metadata cleanup β Processes
single-metadata-deletequeue - Panoramic image metadata cleanup β Processes
pano-metadata-deletequeue - Pre-stitched image metadata cleanup β Processes
prestitch-metadata-deletequeue
Step 3: Batch Deletionβ
For each device ID dequeued:
- Query the metadata index repository for expired records
- Batch delete records from both the index and metadata tables
- Records older than the configured retention period are purged
Repositories Usedβ
Each image type has paired repositories:
| Image Type | Metadata Repository | Index Repository |
|---|---|---|
| Single | ISingleImageMetadataRepository | ISingleImageMetadataIndexRepository |
| Panoramic | IPanoImageMetadataRepository | IPanoImageMetadataIndexRepository |
| Pre-Stitched | IPreStitchImageMetadataRepository | IPreStitchImageMetadataIndexRepository |
Configurationβ
The MetadataCleanupOptions class controls:
| Option | Description |
|---|---|
| Retention period | How long metadata is kept before deletion |
| Batch size | Number of records deleted per batch operation |
| Schedule | CRON expression for the timer trigger |
Documentation Sectionsβ
- Cleanup Operations β Timer and queue-based deletion flow
- Data Structure β Dual-table design: device-partitioned metadata and time-partitioned index tables
- Scaling & Parallelism β Three-queue parallel processing
- Configuration β Retention settings and schedule