Skip to content

Commit fd0fda6

Browse files
achudnovskijclaude
andcommitted
pg::wal::receive: make lsn_to_timeline public
External WAL-processing tools that stream replication (e.g. the wal-listener synchronous receiver) need to resolve which timeline owns a resume LSN by walking a `TIMELINE_HISTORY` response — exactly what the private `lsn_to_timeline` already does. They currently duplicate the parser byte-for- byte. Expose it (follow-up to #19, "Expose replication + object-storage primitives") so the logic lives in one place. No behavior change; the existing unit test still covers it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0bbed31 commit fd0fda6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/pg/wal/receive.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ async fn get_start_timeline(
649649
/// Timeline owning `lsn` per a `.history` file. Each row is
650650
/// `<tli>\t<switch_lsn>\t<comment>`; a switch to `tli+1` happened at
651651
/// `switch_lsn`, so the first row whose switch LSN exceeds `lsn` names its
652-
/// timeline, else the file's own (wal-g LSNToTimeLine)
653-
fn lsn_to_timeline(content: &[u8], lsn: u64, file_timeline: u32) -> u32 {
652+
/// timeline, else the file's own (wal-g LSNToTimeLine).
653+
pub fn lsn_to_timeline(content: &[u8], lsn: u64, file_timeline: u32) -> u32 {
654654
let text = String::from_utf8_lossy(content);
655655
let mut rows: Vec<(u32, u64)> = Vec::new();
656656
for line in text.lines() {

0 commit comments

Comments
 (0)