Skip to content

Commit

Permalink
feat: add serde to some types
Browse files Browse the repository at this point in the history
  • Loading branch information
roeap committed May 3, 2024
1 parent f8103bd commit 3a583d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ default-client = [
"reqwest",
"tokio",
]
serde = []

developer-visibility = []
sync-client = [
Expand Down
3 changes: 2 additions & 1 deletion kernel/src/actions/deletion_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use std::sync::Arc;
use bytes::Bytes;
use delta_kernel_derive::Schema;
use roaring::RoaringTreemap;
use serde::{Deserialize, Serialize};
use url::Url;

use crate::{DeltaResult, Error, FileSystemClient};

#[derive(Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Clone, PartialEq, Eq, Schema, Deserialize, Serialize)]
pub struct DeletionVectorDescriptor {
/// A single character to indicate how to access the DV. Legal options are: ['u', 'i', 'p'].
pub storage_type: String,
Expand Down
17 changes: 9 additions & 8 deletions kernel/src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ pub mod deletion_vector;
pub(crate) mod schemas;
pub(crate) mod visitors;

use std::collections::HashMap;

use delta_kernel_derive::Schema;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use visitors::{AddVisitor, MetadataVisitor, ProtocolVisitor};

use self::deletion_vector::DeletionVectorDescriptor;
use crate::actions::schemas::GetStructField;
use crate::{schema::StructType, DeltaResult, EngineData};

use std::collections::HashMap;

pub(crate) const ADD_NAME: &str = "add";
pub(crate) const REMOVE_NAME: &str = "remove";
pub(crate) const METADATA_NAME: &str = "metaData";
Expand All @@ -41,7 +42,7 @@ pub(crate) fn get_log_schema() -> &'static StructType {
&LOG_SCHEMA
}

#[derive(Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub struct Format {
/// Name of the encoding for files in this table
pub provider: String,
Expand All @@ -58,7 +59,7 @@ impl Default for Format {
}
}

#[derive(Debug, Default, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Default, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub struct Metadata {
/// Unique identifier for this table
pub id: String,
Expand Down Expand Up @@ -90,7 +91,7 @@ impl Metadata {
}
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Default, Debug, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub struct Protocol {
/// The minimum version of the Delta read protocol that a client must implement
/// in order to correctly read this table
Expand All @@ -114,7 +115,7 @@ impl Protocol {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub struct Add {
/// A relative path to a data file from the root of the table or an absolute path to a file
/// that should be added to the table. The path is a URI as specified by
Expand Down Expand Up @@ -172,7 +173,7 @@ impl Add {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub(crate) struct Remove {
/// A relative path to a data file from the root of the table or an absolute path to a file
/// that should be added to the table. The path is a URI as specified by
Expand Down Expand Up @@ -218,7 +219,7 @@ impl Remove {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Schema)]
#[derive(Debug, Clone, PartialEq, Eq, Schema, Serialize, Deserialize)]
pub struct Transaction {
/// A unique identifier for the application performing the transaction.
pub app_id: String,
Expand Down

0 comments on commit 3a583d1

Please sign in to comment.