-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Implement log directory open/create, segment file naming by base offset, and discovery of existing segments. Use a lock file to prevent multiple writers from opening the same log directory.
Scope
- Naming convention: e.g.
segment_<base_offset>.log(and later.idx). Document rules (base_offset, ordering). - Discovery: scan directory for existing segment files; parse base offsets; order segments by base offset.
- Open/create log directory: create if missing; fail or overwrite policy documented.
- Lock file: acquire exclusive lock when opening for write (e.g.
write.lockor OS-specific advisory lock); release on drop. Single-writer guarantee. - Tests: open empty directory (creates nothing or minimal state); open directory with existing segments (discovery returns correct list); lock prevents second writer from opening same path.
Acceptance criteria
- Segment naming and discovery are deterministic and documented.
- Only one writer can hold the log open at a time (enforced via lock file).
- Tests cover empty dir, existing segments, and lock contention behavior.
Suggested commit
feat: implement segment discovery, naming, and directory open
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels