Skip to content

Windows support: abstract POSIX file I/O behind a portable layer #10

@jose-compu

Description

@jose-compu

Problem

The storage and metadata layers use POSIX-only APIs (<fcntl.h>, <unistd.h>, <sys/mman.h>, pwrite, ftruncate, fsync, mmap). LogosDB does not build on Windows.

Proposal

Port the I/O layer to Windows using CreateFileMapping / MapViewOfFile (or std::filesystem + FILE* with FlushFileBuffers). Options:

  1. Introduce a small internal abstraction (src/file_io.h) with open_rw, read_at, write_at, truncate, mmap_readonly, sync. Provide POSIX and Win32 implementations behind #ifdef _WIN32.
  2. Alternatively, wrap everything in std::filesystem + std::fstream and accept the performance cost on Windows only.

Also:

Acceptance criteria

  • cmake --build succeeds with MSVC on Windows.
  • Test suite passes on Windows in CI.
  • README build instructions mention Windows.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededportabilityCross-platform support

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions