Table of Contents

Internal classStaticInternal 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

Public method 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.

Public method 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.

Public method Wrap(string)

Wraps a JSON commit body with a CRC32 trailer.