Skip to content

Self-packaging #3: EmbeddedArchiveFileProvider + FileProviderFactory dispatch #43

Closed

Description

@jrosskopf

Part of epic #40. Depends on #1 (archive_io) and #2 (bundle_locator).

Goal

Serve configs and SQL templates from the in-memory archive when a
bundle is detected. Hook into the existing IFileProvider abstraction
so nothing else in the codebase has to know a bundle exists.

Scope

  • New src/embedded_archive_file_provider.{hpp,cpp} implementing
    IFileProvider (interface at src/include/vfs_adapter.hpp:27-73):
    • ReadFile, FileExists, ListFiles (with glob),
      IsRemotePath (always false for embed:// relative paths),
      GetProviderName.
    • Constructor takes a std::shared_ptr<ArchiveContents> so the
      same decompressed map is shared with the DuckDB filesystem (Minor auth configuration issues #4).
  • Update FileProviderFactory::CreateProvider at
    src/vfs_adapter.cpp:403-408:
    • New dispatch order: remote-scheme → embedded (if bundle
      present) → local.
    • The factory needs an injected ArchiveContents pointer; pass
      nullptr for "no bundle" → behaviour reverts to current logic.
  • Wire detection in src/main.cpp (near the DatabaseManager
    init at lines 154-160):

Red tests (test/cpp/embedded_archive_file_provider_test.cpp)

  1. ReadFile("sqls/customers.sql") returns the bytes that were put
    into the archive.
  2. FileExists matches presence/absence correctly.
  3. ListFiles("sqls", "*.sql") honours the glob pattern at parity
    with LocalFileProvider::ListFiles.
  4. Factory dispatch:
    • bundle present, local-looking path → embedded provider
    • bundle present, s3://… → DuckDB provider (unchanged)
    • bundle absent, local path → LocalFileProvider (unchanged)

Green criteria

  • All four red tests pass.
  • Existing vfs_adapter_test.cpp tests still pass — no regression
    in remote/local dispatch.
  • make integration-test still green (filesystem mode unchanged
    when no bundle is present).

Files

  • New: src/embedded_archive_file_provider.{hpp,cpp},
    test/cpp/embedded_archive_file_provider_test.cpp
  • Modified: src/vfs_adapter.cpp (factory), src/main.cpp (wire-up)

Reuse

  • IFileProvider (src/include/vfs_adapter.hpp:27-73).
  • PathSchemeUtils::IsRemotePath (src/vfs_adapter.cpp:43-44) —
    do NOT alter; embedded provider goes between remote and local.
  • ConfigLoader and SqlTemplateProcessor already accept any
    IFileProvider — no changes there.

Activity

  1. added
    enhancement
    on May 21, 2026
  2. added a commit that references this issue on May 22, 2026
    b2be88e
  3. added 3 commits that reference this issue on May 22, 2026
    1b3a599
    1f0bb8f
    969df3d
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions