Skip to content

Accept smaller reader interfaces in filesystem, extraction, and diff APIs #67

Open

Description

@andrew

NewFS, ExtractAll, and diff.Compare require the full Reader interface, although their implementations only use List and Extract. This prevents using these consumers with Browser, which provides those operations without retaining all expanded file bodies.

To reproduce, construct a browser with OpenBrowser, then pass it to NewFS, ExtractAll, or diff.Compare. The call does not compile because Browser lacks the Hash and Close methods required by Reader.

Introduce a smaller interface for listing and extracting files, and use it where those are the only capabilities required. Existing Reader implementations should remain usable. The separate capability interfaces in mholt/archives illustrate the approach.

Account for browser lifecycle constraints before enabling this use: TAR-based inputs require reopening for later passes, and a browser requires each extracted file to be closed before the next operation. In particular, determine how NewFS should handle multiple open files. Document repeated TAR decompression costs; narrowing the interface alone does not remove them.

Add public API tests covering browser-backed filesystem reads, extraction, and diffs, including a reopening TAR source and existing buffered readers.

Source inspected: origin/main at dc26815591e2353cf40dc890953483664f882bdf. This is a library, so there is no git-pkgs --version output for it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions