Skip to main content

reifydb_codec/
wire.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use reifydb_value::value::frame::frame::Frame;
5use serde::{Deserialize, Serialize};
6
7use crate::frame::decode::decode_frames;
8
9#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "lowercase")]
11pub enum WireFormat {
12	#[default]
13	Frames,
14	Rbcf,
15}
16
17#[derive(Debug, Clone)]
18pub enum RawChangePayload {
19	Rbcf(Vec<u8>),
20	Empty,
21}
22
23impl RawChangePayload {
24	pub fn into_frames(self) -> Vec<Frame> {
25		match self {
26			Self::Rbcf(bytes) => decode_frames(&bytes).unwrap_or_default(),
27			Self::Empty => Vec::new(),
28		}
29	}
30}