Skip to content

Commit 0b3fd10

Browse files
committed
replication: add raw plugin that just passes bytes over
This plugin does no processing and just passing the information through. Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
1 parent d46ada0 commit 0b3fd10

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

postgres-protocol/src/replication/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ use std::collections::HashMap;
22

33
use crate::message::backend::Parse;
44

5+
pub mod raw;
6+
7+
pub use raw::Raw;
8+
59
pub trait DecodingPlugin {
610
type Message: Parse;
711

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use std::collections::HashMap;
2+
3+
use bytes::Bytes;
4+
5+
use crate::replication::DecodingPlugin;
6+
7+
pub struct Raw {
8+
name: String,
9+
options: HashMap<String, String>,
10+
}
11+
12+
impl Raw {
13+
pub fn new(name: String, options: HashMap<String, String>) -> Self {
14+
Self { name, options }
15+
}
16+
}
17+
18+
impl DecodingPlugin for Raw {
19+
type Message = Bytes;
20+
21+
fn name(&self) -> &str {
22+
&self.name
23+
}
24+
25+
fn options(&self) -> HashMap<String, String> {
26+
self.options.clone()
27+
}
28+
}

0 commit comments

Comments
 (0)