Refactor log API to perform compaction/retention using segmented logs.
Add examples to README documentation.