Skip to main content

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-delete queue
  • Panoramic image metadata cleanup β€” Processes pano-metadata-delete queue
  • Pre-stitched image metadata cleanup β€” Processes prestitch-metadata-delete queue

Step 3: Batch Deletion​

For each device ID dequeued:

  1. Query the metadata index repository for expired records
  2. Batch delete records from both the index and metadata tables
  3. Records older than the configured retention period are purged

Repositories Used​

Each image type has paired repositories:

Image TypeMetadata RepositoryIndex Repository
SingleISingleImageMetadataRepositoryISingleImageMetadataIndexRepository
PanoramicIPanoImageMetadataRepositoryIPanoImageMetadataIndexRepository
Pre-StitchedIPreStitchImageMetadataRepositoryIPreStitchImageMetadataIndexRepository

Configuration​

The MetadataCleanupOptions class controls:

OptionDescription
Retention periodHow long metadata is kept before deletion
Batch sizeNumber of records deleted per batch operation
ScheduleCRON expression for the timer trigger

Documentation Sections​