Skip to main content

Storage Architecture

The BaseImageStorageService provides shared functionality for all image storage operations.

Blob Path Generation​

Every image is stored using a time-partitioned path:

{deviceId}/{imageType}/{year}/{month:00}/{day:00}/{hour:00}/{minute:00}/{filename}

This structure:

  • Groups images by camera and type for easy retrieval
  • Time-partitions by hour and minute for efficient range queries
  • Follows Azure Blob Storage best practices for avoiding hot partitions

Base Class Responsibilities​

The abstract BaseImageStorageService handles:

  1. Blob path generation β€” Consistent path format across all image types
  2. Metadata creation β€” Builds Table Storage entities with image metadata
  3. SignalR broadcasting β€” Sends metadata to connected frontends after storage
  4. Thumbnail generation β€” Creates resized versions of stored images

Concrete implementations (SingleImageStorageService, PanoImageStorageService, PreStitchedImageStorageService) override only the image-type-specific logic.

Metadata Storage​

For each image stored in Blob Storage, a corresponding metadata record is written to Table Storage:

FieldDescription
PartitionKeyDevice ID
RowKeyTimestamp-based unique key
BlobUrlURL to the image in Blob Storage
ThumbnailUrlURL to the thumbnail
ImageTypesingle, panorama, or pre-stitched
PTZPan/tilt/zoom position at capture time
TimestampCapture timestamp

This dual-write pattern (Blob + Table) allows fast metadata queries without listing blob containers.