dlcs / protagonist

MIT License
7 stars 2 forks source link

Handle Deletions #251

Closed donaldgray closed 1 year ago

donaldgray commented 2 years ago

Update API to cleanly handle items deleted from DLCS.

A deletion action can clean up some resources that the API knows about (ie DB rows) and then raise a notification that can be listened to.

The listener for this service can either be a single deletion service, or respective service can each listen for notifications. We'll need to remove:

donaldgray commented 1 year ago

https://github.com/dlcs/protagonist/pull/438 contains DeleteHandler app. This is for Deliverator so will need exanded, namely to handle deleting info.json and T / F assets

donaldgray commented 1 year ago

The DeleteHandler project for Deliverator runs as an dockerized service for ease. We should consider running this as a lambda in AWS - either via container or as a script as it will be seldom used.

donaldgray commented 1 year ago

The storage-keys document outlines what keys can possibly be used for asset storage. These should drive the bulk of the delete logic, dependant on the type of asset. In addition to that we'll need to:

donaldgray commented 1 year ago

Deleting named queries need to raise a delete notification as it could result in the deletion if a number of generated NQ projections #540

tomcrane commented 1 year ago

Acceptance Criteria

MVP

Invalidation of stored NQ projections is not MVP.

Invalidation of Varnish cache is covered by https://github.com/dlcs/dlcs-varnish/issues/3

(Later those last three cache invalidation operations can be refactored into https://github.com/dlcs/protagonist/issues/252 and CleanupHandler will call a new cacheInvalidation queue)

Note Removed Varnish cache from checklist as it's covered by linked ticket

donaldgray commented 1 year ago

The list of possible paths that can be invalidated will depend on the asset. In below examples I'm using assetId of 1/2/foo.

Rules based on delivery-channel (an asset may have more than 1 of these):

Rules based on assetFamily (these will change to d-c in future)

A single invalidation includes 7 wildcards so we can only have 2 in-flight with CloudFront at any given time.