Port of a ring buffer that overwrites prior writes rather than ceases writing.
Tests ported to test overwrite behavior.