Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to load bundles from an arbitrary filesystem
Support OPA Client SDK programs loading bundles from an arbitraty filesystem, such as an in-memory filesystem, which unlocks additional uses that include compiling a bundle to an intermediate representation from a client program rather than the OPA command line. Fixes #5833 bundle: Add filesystem support Soften constraint in `Equal` method to support bundle comparison for rootless filesystems, eg treat "/file" and "file" as equal for both URLs and Paths Add `WithPathFormat` for `DirectoryLoader` builders to centralise logic for how paths are returned during file traversal, ie in `NextFile` Add support for specifiying the root directory for `dirLoaderFS` compile: Add filesystem support Add `WithFS` builder helper to pass into `initload.LoadPaths` to load bundles from a filesystem internal/runtime/init: Add filesystem support Pass newly supplied `fsys fs.FS` parameter in `LoadPaths` into file loader builder loader: Add filesystem support Add new `GetBundleDirectLoaderFS` which can load bundles from the supplied filesystem runtime: Add filesystem support Pass-through nil parameter as `fsys fs.FS` parameter into `initLoad.LoadPaths` (OPA servers/repls are not in scope for loading from filesystem) util/test: Add in-memory filesystem support Add new `WithTestFS` helper to allow tests that currently use `WithTempFS` to choose between a disk-based or memory-based filesystem - now used throughout `compile_test` Signed-off-by: Kieran Othen <kieran.othen@mac.com>
- Loading branch information
1 parent
1ec047c
commit b65c68e
Showing
11 changed files
with
863 additions
and
619 deletions.
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
Oops, something went wrong.