gristlabs_grist-core/app/gen-server/lib
Alex Hall ec8460b772 (core) Prune snapshots outside the window in product features
Summary:
- Add a method `getSnapshotWindow` to `IInventory` and `DocSnapshotInventory`. It returns a `SnapshotWindow`, which represents a duration of time for which we keep backups for a particular document.
- `DocSnapshotPruner` calls this method and passes the window to `shouldKeepSnapshots` to determine which document versions have fallen outside the window and should be pruned.
- The implementation passed to `DocSnapshotInventory` uses a new method `getDocProduct` in `HomeDBManager` which directly returns the `Product` associated with a document, given only the document ID. Other methods in `HomeDBManager` require passing more information, especially about a user, but `DocSnapshotPruner` only knows about document IDs.

Test Plan: Added a test for `getDocProduct` and a test for `DocSnapshotPruner` where `getSnapshotWindow` is specified.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3322
2022-03-18 18:48:14 +02:00
..
DocApiForwarder.ts
DocWorkerMap.ts (core) be careful when reassigning a doc to a worker it was on before 2022-03-08 17:20:01 -05:00
Doom.ts
HomeDBManager.ts (core) Prune snapshots outside the window in product features 2022-03-18 18:48:14 +02:00
Housekeeper.ts
Permissions.ts
scrubUserFromOrg.ts
TypeORMPatches.ts
Usage.ts
values.ts