Add log compaction

State machine interface is not implemented.

Save int value as the current state of the machine.

Uncomment L261 to start from snapshot.

Not fully tested