Skip to content

Commit

Permalink
feat: helper methods on WalOp
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltontj committed Oct 23, 2024
1 parent f1bd868 commit b0d5a9f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions influxdb3_wal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,22 @@ pub enum WalOp {
Catalog(CatalogBatch),
}

impl WalOp {
pub fn as_write(&self) -> Option<&WriteBatch> {
match self {
WalOp::Write(w) => Some(w),
WalOp::Catalog(_) => None,
}
}

pub fn as_catalog(&self) -> Option<&CatalogBatch> {
match self {
WalOp::Write(_) => None,
WalOp::Catalog(c) => Some(c),
}
}
}

#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct CatalogBatch {
pub database_id: DbId,
Expand Down

0 comments on commit b0d5a9f

Please sign in to comment.