From 14497e4c6540b415633f1da7e465327a246625e5 Mon Sep 17 00:00:00 2001 From: Kris Wehner Date: Wed, 7 Dec 2016 21:19:58 -0800 Subject: [PATCH] Capitalization --- replication.go | 10 +++++----- replication_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/replication.go b/replication.go index 66860787..5586209c 100644 --- a/replication.go +++ b/replication.go @@ -22,13 +22,13 @@ func init() { // Format the given 64bit LSN value into the XXX/XXX format, // which is the format reported by postgres. -func FormatLsn(lsn int64) string { - return fmt.Sprintf("%X/%X", lsn>>32, int32(lsn)) +func FormatLSN(lsn int64) string { + return fmt.Sprintf("%X/%X", uint32(lsn>>32), uint32(lsn)) } // Parse the given XXX/XXX format LSN as reported by postgres, // into a 64 bit integer as used internally by the wire procotols -func ParseLsn(lsn string) (outputLsn int64, err error) { +func ParseLSN(lsn string) (outputLsn int64, err error) { var upperHalf int64 var lowerHalf int64 var nparsed int @@ -72,7 +72,7 @@ func (w *WalMessage) ByteLag() int64 { } func (w *WalMessage) String() string { - return fmt.Sprintf("Wal: %s Time: %s Lag: %d", FormatLsn(w.WalStart), w.Time(), w.ByteLag()) + return fmt.Sprintf("Wal: %s Time: %s Lag: %d", FormatLSN(w.WalStart), w.Time(), w.ByteLag()) } // The server heartbeat is sent periodically from the server, @@ -93,7 +93,7 @@ func (s *ServerHeartbeat) Time() time.Time { } func (s *ServerHeartbeat) String() string { - return fmt.Sprintf("WalEnd: %s ReplyRequested: %d T: %s", FormatLsn(s.ServerWalEnd), s.ReplyRequested, s.Time()) + return fmt.Sprintf("WalEnd: %s ReplyRequested: %d T: %s", FormatLSN(s.ServerWalEnd), s.ReplyRequested, s.Time()) } // The replication message wraps all possible messages from the diff --git a/replication_test.go b/replication_test.go index 60119b14..08affdf1 100644 --- a/replication_test.go +++ b/replication_test.go @@ -158,9 +158,9 @@ func TestSimpleReplicationConnection(t *testing.T) { } restartLsn := getConfirmedFlushLsnFor(t, conn, "pgx_test") - integerRestartLsn, _ := pgx.ParseLsn(restartLsn) + integerRestartLsn, _ := pgx.ParseLSN(restartLsn) if integerRestartLsn != maxWal { - t.Fatalf("Wal offset update failed, expected %s found %s", pgx.FormatLsn(maxWal), restartLsn) + t.Fatalf("Wal offset update failed, expected %s found %s", pgx.FormatLSN(maxWal), restartLsn) } _, err = conn.Exec("select pg_drop_replication_slot($1)", "pgx_test")