-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): Generalize binary data manager interface (no-changelog) #7164
Merged
ivov
merged 115 commits into
master
from
pay-768-generalize-binary-data-manager-interface
Sep 22, 2023
Merged
Changes from 107 commits
Commits
Show all changes
115 commits
Select commit
Hold shift + click to select a range
29f1d11
refactor(core): Simplify executions and binary data pruning
netroy f7206fd
Merge branch 'master' into pay-771-implement-soft-deletion
ivov 9c8efbc
Merge branch 'master' into pay-771-implement-soft-deletion
ivov 05e3fef
Remove test code from service
ivov 9dabbe8
Use time constants
ivov 3f7de8e
Improve naming
ivov 5583814
Use native typeorm soft deletion
ivov f50108a
Improve naming
ivov 85ac53a
Make batch size class field
ivov 1d87e9e
Cleanup
ivov dd16e45
Remove unused method
ivov 619bff6
Cleanup
ivov 8cace11
Filter out soft-deleted executions
ivov 1fea046
Merge branch 'master' into pay-771-implement-soft-deletion
ivov c4ffe6d
Add tests
ivov 738eb1b
Improve test
ivov 259fe75
Soft-delete in single pass
ivov f3f5b27
Restore value
ivov 65d17cb
Restore from debug value
ivov 96ae7b4
Add clarifying comments
ivov 21040b5
Update tests
ivov aa4d633
Add `typedi` to core
ivov e54becb
Update package.json
ivov 80e7258
Turn `BinaryDataManager` into service
ivov 3a8960f
Add `object` to binary data schema options
ivov 64b1a96
Use service throughout core and cli
ivov f974b55
Update tests
ivov 36d0243
Reduce diff
ivov 5e209e9
Update default
ivov 0c3a6aa
Add docline
ivov 3d4beba
Remove redundant output types
ivov 1bf7a3d
Remove unused type
ivov 1152092
Rename to submanagers to client
ivov 5627b4c
Rename `BinaryDataFileSystem` to `FileSystemClient`
ivov 6451750
Clean up types
ivov 7a7ad54
Move `binaryToBuffer` to manager
ivov cdfe2fc
Rename `BinaryDataManager` to `BinaryDataService`
ivov b5bc390
Unify storage path naming
ivov c876697
Set binary data service in nodes-base test helper
ivov 25a796c
Rename manager in nodes-base
ivov 538d318
More renamings
ivov c7cf4b1
Generalize interface
ivov 307bb1b
Continue generalizing
ivov a2528d7
Fix test
ivov d0cd85e
Better naming
ivov bfdbdf5
More renamings
ivov 25e80b9
Minor cleanup
ivov 3476f6c
More minor cleanup
ivov 9a25301
Add clarifying comment
ivov 0e075c2
Speed up pruning if high volume
ivov e8ccf05
Merge branch 'master' into pay-771-implement-soft-deletion
ivov 2071c7f
Remove call from hook
ivov be44721
Merge parent branch
ivov 1d50b61
Refix conflict
ivov e042e91
Add formats to schema
ivov e948f8f
Add `ensureStringArray` util
ivov 0feb926
Adjust types based on parsing
ivov c73f18c
Add type guard
ivov f8fec92
Clean up types in `init()`
ivov 93ea57c
Fix test
ivov c8676be
Remove unneeded modifier
ivov 25006e8
Cleanup
ivov a7156f8
Fix node tests
ivov e0e90b6
Remove unneeded line
ivov 219addb
Rename constant
ivov d7c7f5f
Remove comment
ivov 1ea380d
Fix tests
ivov a5b388b
Cleanup
ivov 9204754
Rename error
ivov 9597508
Improve error message
ivov 8fde8be
Better error
ivov ada012e
Better message
ivov 67e163f
Make execution ID non-nullable
ivov 9665da1
Merge master
ivov 12636dd
Readability improvements
ivov e5c8c72
Adjust types, followup to 67e163f
ivov 8849007
Merge parent branch
ivov b7062e5
Fix lint
ivov 79ecaa9
Fix lint
ivov 02b6d86
Cleanup
ivov 96ea9ea
Comment out cache keys
ivov 3d76b21
Revert "Comment out cache keys"
ivov 455c327
Rename dir to `TempBinaryData`
ivov 65b4fb0
Rename back to `BinaryData`
ivov 3bf3430
Merge master
ivov abe6d9d
Clear timers on shutdown
ivov 2682b3d
Set timers only on main instance
ivov 1c788fe
Also for clearing timers
ivov f248982
Merge parent branch
ivov 04f4b83
Rename back to `localStoragePath`
ivov 03264f9
Remove unused arg
ivov a6e33d4
Fix lint
ivov 8823554
Add logging, refactor for readability
ivov a5def40
Ensure hard-deletion select includes soft-deleted rows
ivov 77955e4
Switch `info` to `debug`
ivov b930e3e
Fix tests
ivov e91f3de
Remove redundant checks for `deletedAt` being `NULL`
ivov 2c3704d
Fix lint
ivov 215f58e
Fix last test
ivov c33d164
More missing loggers in tests
ivov 69764f7
Add logger to even more test
ivov 7c3e58d
Refactor logging for tests
ivov 6fe79b8
Merge parent branch
ivov 4f025b2
Merge master, fix conflicts
ivov 80a4fc5
Fix misresolved conflict
ivov 20d5ea7
Remove excess check on init
ivov 0f84eb6
Remove `ObjectStore.manager.ts` stub
ivov 605d02b
Revert rename to `BinaryDataManager`
ivov c430f22
Missing renaming in test
ivov 0cdfb79
Rename constant
ivov 08ce3f7
Merge master
ivov 61c2f5a
Restore `LogCatch`
ivov 74adb24
Add file not found error to `getSize`
ivov 0bc2457
Add `mode` to `InvalidBinaryDataManagerError`
ivov d27e4c4
Delete many by execution IDs only if manager available
ivov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { SchemaObj } from 'convict'; | ||
|
||
class NotStringArrayError extends Error { | ||
constructor(env: string) { | ||
super(`${env} is not a string array.`); | ||
} | ||
} | ||
|
||
export const ensureStringArray = (values: string[], { env }: SchemaObj<string>) => { | ||
if (!env) throw new Error(`Missing env: ${env}`); | ||
|
||
if (!Array.isArray(values)) throw new NotStringArrayError(env); | ||
|
||
for (const value of values) { | ||
if (typeof value !== 'string') throw new NotStringArrayError(env); | ||
} | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming this is a breaking change, and should be documented in
BREAKING-CHANGES.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted:
605d02b
Maybe in future we can bundle all changes like this together, to minimize annoyance for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are reverting, can we revert all of the renaming, and not just the config? either that, or we don't revert and list this as a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is benefit in a temporary middle ground. Preexisting code uses "manager" for both binary data manager and its modes, so it's rather confusing and inconsistent. With this division into service and managers, the distinction is clearer, and the inconsistency is reduced to only this handful of entrypoint config spots where the renaming would cause a breaking change. So on balance the bulk of code becomes clearer.