feat: helper methods on WalOp (#25486)

praveen/fix-telemetry-url-panic
Trevor Hilton 2024-11-01 17:19:20 -04:00 committed by GitHub
parent d26a73802a
commit 5698e79a34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -212,6 +212,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,