Skip to content
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

fs: split out include/exclude into new FilterFS #167

Merged
merged 3 commits into from
Aug 25, 2023

Commits on Aug 8, 2023

  1. fs: split out include/exclude into new FilterFS

    This patch creates a new FilterFS to pair with a new FilterOpt, which
    contains the old WalkOpt parameters.
    
    Essentially, this splits the functionality of the old FS into a new FS
    and the FilterFS. The new FS implemenation simply performs operations
    over a specified local filesystem, while the FilterFS wraps an existing
    FS implementation to apply filtering patterns.
    
    This allows the same logic for filtering to apply to *any* underlying
    filesystem, for example, the StaticFS and MergeFS implementations in
    BuildKit.
    
    To do this, we also make some reasonably substantial changes to the
    developer-facing API. We need to use fs.WalkDirFunc instead of the old
    filepath.WalkFunc, which is required to preserve the lazy stat()
    semantics from b9e22fc.
    
    Existing implementations and callers of FS should fairly easily be able
    to update to support the new API, which just requires updating to
    support a new "path" parameter, and modify the signature to be
    fs.WalkDirFunc (which may actually improve performance depending on the
    exact usage).
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    jedevc committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    87ffeeb View commit details
    Browse the repository at this point in the history
  2. fs: prevent filtered paths from being opened

    Paths removed by the include/exclude filters should not be allowed to be
    opened by the Open function.
    
    To prevent constructing the patternmatcher objects and traversing the
    filesystem using FollowLinks for each call to Open, the patternmatcher
    objects are constructed at the point of creation of the FilterFS.
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    jedevc committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    a9fa946 View commit details
    Browse the repository at this point in the history
  3. fs: improve docs for fs structs and functions

    Signed-off-by: Justin Chadwell <me@jedevc.com>
    jedevc committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    da27602 View commit details
    Browse the repository at this point in the history