risingwave_hummock_sdk::key

Function prev_epoch

source
pub fn prev_epoch(epoch: &[u8]) -> Vec<u8> 
Expand description

compute the prev epoch, and don’t change the bytes of the u8 slice.

§Examples

use risingwave_hummock_sdk::key::prev_epoch;
assert_eq!(prev_epoch(b"124"), b"123");
assert_eq!(prev_epoch(b"\xff\x01\x00"), b"\xff\x00\xff");
assert_eq!(prev_epoch(b"\x00\x00"), b"\xff\xff");
assert_eq!(prev_epoch(b"\x00\x01"), b"\x00\x00");
assert_eq!(prev_epoch(b"T"), b"S");
assert_eq!(prev_epoch(b""), b"");