feat: split cache deletion into swap and update job types - #222
Closed
razbroc wants to merge 1 commit into
Closed
Conversation
Replaces the single Delete_Cache job type with Swap_Delete_Cache and Update_Delete_Cache. Cache invalidation after a layer swap and after an in-place update are different operations with different task parameters: a swap invalidates the whole key prefix, an update invalidates specific tile ranges. Workers resolve strategies by the (jobType, taskType) pair, so a single Delete_Cache job type collapsed both cases onto one token and forced the strategy to discriminate on the parameter shape at runtime. Two job types give two tokens and let each resolve to its own strategy. The cache-deletion task type is unchanged and used by both. Adds CONTEXT.md, a glossary for the deletion and storage vocabulary.
|
Hi it is me, your friendly bot helper! 👋 {
"dependencies": {
"@map-colonies/raster-shared": "https://ghatmpstorage.blob.core.windows.net/npm-packages/raster-shared-20df345e2a1bfd26c0f2ce306882501f88c34777.tgz"
}
}The link will expire in a week ⌛ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces
DeletionJobTypes.Delete_Cachewith two job types:DeletionTaskTypes.CacheDeletion: 'cache-deletion'is unchanged and is used by both.Why
Cache invalidation after a layer swap and after an in-place update are different operations carrying different task parameters:
Swap_Delete_Cachecache-deletionredisDeleteStoredResourcesParamsSchema(prefix)Update_Delete_Cachecache-deletionredisTilesDeletionParamsSchema(prefix+ranges)Workers resolve a strategy from the pair
`${jobType}-${taskType}`(seecleaner'sdependencyRegistration.ts). A singleDelete_Cachejob type collapses both cases onto one token, so one strategy would have to sniff the parameter shape at runtime and branch — giving up the compile-time dispatch the pair design exists to provide. Two job types give two tokens, each resolving to its own strategy.Splitting at the job level rather than adding a second task type is deliberate: the distinction reflects the upstream event (a swap happened vs. an update happened), which is known when the job is created. Encoding it in the task type would push that choice down a layer.
Also
/* eslint-enable @typescript-eslint/naming-convention */.CONTEXT.md— a glossary pinning layer deletion / cache deletion / artifacts deletion / tiles deletion, and source type vs storage provider. These are close enough to be confusable and weren't written down anywhere.No job-params schemas were added. The entire swap/update difference lives in the task params, so a
swapDeleteCacheJobParamsSchemawould be an empty object today — worse than no schema, since consumers would validate against it and get false confidence.Companion work needed in
cleanerNot caused by this PR, but it ships alongside changes already on
alphathat breakcleaner:tilesPath→tilesRelativePathandsourceProvider→storageProvider;TilesDeletionStrategyreads both (3 sites).TilesDeletionParamsmoved fromtypes/coretotypes/deletion(still exported from the root barrel).cleanerhas no Redis storage provider yet — the newREDISbranch in both param unions will surface as a compile error inresolveStorageProvideruntil one is added.Verification
npm run lintandtsc --project tsconfig.build.json --noEmitboth pass. No tests added — the repo has no tests over constants.