

CommitFileFormat
- Namespace
- Rowles.LeanLucene.Index
- Assembly
- Rowles.LeanLucene.dll
On-disk format helpers for segments_N commit files. Commits written by
IndexWriter append a trailer of the form
\n#crc32=<hex>\n after the JSON body so torn writes can be detected
on recovery. This helper centralises read/write so every parser strips and
validates the trailer consistently.
internal static class CommitFileFormat
CommitFileFormat
ReadJson(string)
Reads a commit file, returning the JSON body with any CRC trailer stripped and validated. Throws System.IO.InvalidDataException if the trailer is present but does not match the body.
TryReadJson(string)
Returns the JSON body if the trailer is absent or matches; otherwise null. Suitable for recovery code paths that prefer to fall back to an older commit.
Wrap(string)
Wraps a JSON commit body with a CRC32 trailer.