-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Split unpacking an archive and caching its files into separate functions #83085
Conversation
paths, | ||
}; | ||
} | ||
|
||
export function parseAndVerifyArchive(paths: string[]): ArchivePackage { |
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.
parseAndVerifyArchive
needs to read any manifest.yml
files in the archive to do its validation. Instead of sharing the existing memory cache, use a local map. It only holds a few entries only needs them while parsing. Now it's not coupled to any other implementation or order.
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/ingest-management (Team:Ingest Management) |
…e functions (#83085) (#83153) ## Summary * Separate unpacking an archive from caching it or other side-effects * Parse and validate an archive before caching it * Validation has no coupling with caching side-effects or any other code outside the `validation.ts` file ```diff - const paths = await unpackArchiveToCache(archiveBuffer, contentType); - const archivePackageInfo = parseAndVerifyArchive(paths); + const entries = await unpackArchiveEntries(archiveBuffer, contentType); + const { archivePackageInfo } = await parseAndVerifyArchiveEntries(entries); + const paths = addEntriesToMemoryStore(entries); ``` ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Summary
validation.ts
fileChecklist