Separating compacting logic from persistence