mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-23 06:09:59 +00:00
Remove leftover duplicated code to start replication connection
This commit is contained in:
committed by
Stas Kelvich
parent
9a9480e8c9
commit
eac04d7f10
28
src/main.rs
28
src/main.rs
@@ -4,6 +4,8 @@ mod page_cache;
|
||||
mod walreader;
|
||||
mod walreceiver;
|
||||
|
||||
use std::io::Error;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
|
||||
|
||||
@@ -17,31 +19,5 @@ fn main() -> Result<(), Error> {
|
||||
|
||||
handler.join(); // never returns.
|
||||
|
||||
let conninfo = "host=localhost port=65432 user=stas dbname=postgres";
|
||||
// form replication connection
|
||||
let (mut rclient, rconnection) =
|
||||
connect_replication(conninfo, NoTls, ReplicationMode::Physical).await?;
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = rconnection.await {
|
||||
eprintln!("connection error: {}", e);
|
||||
}
|
||||
});
|
||||
let identify_system = rclient.identify_system().await?;
|
||||
let mut physical_stream = rclient
|
||||
.start_physical_replication(None, identify_system.xlogpos(), None)
|
||||
.await?;
|
||||
while let Some(replication_message) = physical_stream.next().await {
|
||||
match replication_message? {
|
||||
ReplicationMessage::XLogData(xlog_data) => {
|
||||
// eprintln!("received XLogData: {:#?}", xlog_data);
|
||||
eprintln!("received XLogData:");
|
||||
}
|
||||
ReplicationMessage::PrimaryKeepAlive(keepalive) => {
|
||||
// eprintln!("received PrimaryKeepAlive: {:#?}", keepalive);
|
||||
eprintln!("received PrimaryKeepAlive:");
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user