Skip to content

Commit ca28907

Browse files
committed
protocol: derive Debug for replication items
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
1 parent 6f1a0e4 commit ca28907

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

postgres-protocol/src/message/backend.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ impl Message {
312312

313313
/// An enum representing Postgres backend replication messages.
314314
#[non_exhaustive]
315+
#[derive(Debug)]
315316
pub enum ReplicationMessage<D> {
316317
XLogData(XLogDataBody<D>),
317318
PrimaryKeepAlive(PrimaryKeepAliveBody),
@@ -875,6 +876,7 @@ impl RowDescriptionBody {
875876
}
876877
}
877878

879+
#[derive(Debug)]
878880
pub struct XLogDataBody<D> {
879881
wal_start: u64,
880882
wal_end: u64,
@@ -909,6 +911,7 @@ impl<D> XLogDataBody<D> {
909911
}
910912
}
911913

914+
#[derive(Debug)]
912915
pub struct PrimaryKeepAliveBody {
913916
wal_end: u64,
914917
timestamp: i64,

postgres-protocol/src/replication/pgoutput.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const REPLICA_IDENTITY_FULL_TAG: u8 = b'f';
6363
const REPLICA_IDENTITY_INDEX_TAG: u8 = b'i';
6464

6565
#[non_exhaustive]
66+
#[derive(Debug)]
6667
pub enum LogicalReplicationMessage {
6768
Begin(BeginBody),
6869
Commit(CommitBody),
@@ -235,6 +236,7 @@ impl Parse for LogicalReplicationMessage {
235236
}
236237
}
237238

239+
#[derive(Debug)]
238240
pub struct Tuple(Vec<TupleData>);
239241

240242
impl Tuple {
@@ -256,6 +258,7 @@ impl Parse for Tuple {
256258
}
257259
}
258260

261+
#[derive(Debug)]
259262
pub struct Column {
260263
flags: i8,
261264
name: Bytes,
@@ -296,6 +299,7 @@ impl Parse for Column {
296299
}
297300
}
298301

302+
#[derive(Debug)]
299303
pub enum TupleData {
300304
Null,
301305
Toast,
@@ -325,6 +329,7 @@ impl Parse for TupleData {
325329
}
326330
}
327331

332+
#[derive(Debug)]
328333
pub struct BeginBody {
329334
final_lsn: u64,
330335
timestamp: i64,
@@ -348,6 +353,7 @@ impl BeginBody {
348353
}
349354
}
350355

356+
#[derive(Debug)]
351357
pub struct CommitBody {
352358
flags: i8,
353359
commit_lsn: u64,
@@ -377,6 +383,7 @@ impl CommitBody {
377383
}
378384
}
379385

386+
#[derive(Debug)]
380387
pub struct OriginBody {
381388
commit_lsn: u64,
382389
name: Bytes,
@@ -394,6 +401,7 @@ impl OriginBody {
394401
}
395402
}
396403

404+
#[derive(Debug)]
397405
pub enum ReplicaIdentity {
398406
/// default selection for replica identity (primary key or nothing)
399407
Default,
@@ -407,6 +415,7 @@ pub enum ReplicaIdentity {
407415
Index,
408416
}
409417

418+
#[derive(Debug)]
410419
pub struct RelationBody {
411420
rel_id: u32,
412421
namespace: Bytes,
@@ -442,6 +451,7 @@ impl RelationBody {
442451
}
443452
}
444453

454+
#[derive(Debug)]
445455
pub struct TypeBody {
446456
id: u32,
447457
namespace: Bytes,
@@ -465,6 +475,7 @@ impl TypeBody {
465475
}
466476
}
467477

478+
#[derive(Debug)]
468479
pub struct InsertBody {
469480
rel_id: u32,
470481
tuple: Tuple,
@@ -482,6 +493,7 @@ impl InsertBody {
482493
}
483494
}
484495

496+
#[derive(Debug)]
485497
pub struct UpdateBody {
486498
rel_id: u32,
487499
old_tuple: Option<Tuple>,
@@ -511,6 +523,7 @@ impl UpdateBody {
511523
}
512524
}
513525

526+
#[derive(Debug)]
514527
pub struct DeleteBody {
515528
rel_id: u32,
516529
old_tuple: Option<Tuple>,
@@ -534,6 +547,7 @@ impl DeleteBody {
534547
}
535548
}
536549

550+
#[derive(Debug)]
537551
pub struct TruncateBody {
538552
options: i8,
539553
rel_ids: Vec<u32>,

0 commit comments

Comments
 (0)