Initial commit
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
//! Lineage configuration types.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Configuration for lineage tracking
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LineageConfig {
|
||||
/// Enable automatic lineage capture
|
||||
pub auto_capture: bool,
|
||||
/// Track schema evolution
|
||||
pub track_schema_evolution: bool,
|
||||
/// Enable field-level lineage
|
||||
pub field_level_lineage: bool,
|
||||
/// Maximum lineage depth to track
|
||||
pub max_lineage_depth: usize,
|
||||
/// Retention policy for lineage data
|
||||
pub retention_policy: LineageRetentionPolicy,
|
||||
/// Impact analysis configuration
|
||||
pub impact_analysis: ImpactAnalysisConfig,
|
||||
/// Lineage storage backend
|
||||
pub storage_backend: LineageStorageBackend,
|
||||
}
|
||||
|
||||
impl Default for LineageConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
auto_capture: true,
|
||||
track_schema_evolution: true,
|
||||
field_level_lineage: true,
|
||||
max_lineage_depth: 20,
|
||||
retention_policy: LineageRetentionPolicy::TimeBased { retention_days: 90 },
|
||||
impact_analysis: ImpactAnalysisConfig::default(),
|
||||
storage_backend: LineageStorageBackend::InMemory,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Lineage retention policies
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum LineageRetentionPolicy {
|
||||
/// Time-based retention
|
||||
TimeBased {
|
||||
/// Number of days to retain
|
||||
retention_days: u32,
|
||||
},
|
||||
/// Count-based retention
|
||||
CountBased {
|
||||
/// Maximum number of lineage entries
|
||||
max_entries: usize,
|
||||
},
|
||||
/// Size-based retention
|
||||
SizeBased {
|
||||
/// Maximum storage size in bytes
|
||||
max_size_bytes: usize,
|
||||
},
|
||||
/// Never delete lineage data
|
||||
Never,
|
||||
}
|
||||
|
||||
/// Impact analysis configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ImpactAnalysisConfig {
|
||||
/// Enable downstream impact analysis
|
||||
pub enable_downstream: bool,
|
||||
/// Enable upstream dependency analysis
|
||||
pub enable_upstream: bool,
|
||||
/// Maximum analysis depth
|
||||
pub max_analysis_depth: usize,
|
||||
/// Include data quality impact
|
||||
pub include_quality_impact: bool,
|
||||
/// Include performance impact
|
||||
pub include_performance_impact: bool,
|
||||
}
|
||||
|
||||
impl Default for ImpactAnalysisConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enable_downstream: true,
|
||||
enable_upstream: true,
|
||||
max_analysis_depth: 10,
|
||||
include_quality_impact: true,
|
||||
include_performance_impact: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage backends for lineage data
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum LineageStorageBackend {
|
||||
/// In-memory storage (for testing)
|
||||
InMemory,
|
||||
/// `PostgreSQL` storage
|
||||
PostgreSQL {
|
||||
/// Connection string
|
||||
connection_string: String,
|
||||
},
|
||||
/// Graph database storage
|
||||
GraphDatabase {
|
||||
/// Database type
|
||||
database_type: GraphDatabaseType,
|
||||
/// Connection configuration
|
||||
connection_config: GraphConnectionConfig,
|
||||
},
|
||||
/// File-based storage
|
||||
File {
|
||||
/// Storage directory
|
||||
directory: String,
|
||||
/// File format
|
||||
format: FileFormat,
|
||||
},
|
||||
}
|
||||
|
||||
/// Graph database types
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum GraphDatabaseType {
|
||||
/// Neo4j
|
||||
Neo4j,
|
||||
/// Amazon Neptune
|
||||
Neptune,
|
||||
/// `ArangoDB`
|
||||
ArangoDB,
|
||||
}
|
||||
|
||||
/// Graph database connection configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct GraphConnectionConfig {
|
||||
/// Host
|
||||
pub host: String,
|
||||
/// Port
|
||||
pub port: u16,
|
||||
/// Username
|
||||
pub username: String,
|
||||
/// Password
|
||||
pub password: String,
|
||||
/// Database name
|
||||
pub database: Option<String>,
|
||||
}
|
||||
|
||||
/// File formats for lineage storage
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum FileFormat {
|
||||
/// JSON format
|
||||
Json,
|
||||
/// Parquet format
|
||||
Parquet,
|
||||
/// CSV format
|
||||
Csv,
|
||||
}
|
||||
|
||||
/// Export formats for lineage visualization
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum LineageExportFormat {
|
||||
/// `GraphML` format
|
||||
GraphML,
|
||||
/// DOT format (Graphviz)
|
||||
Dot,
|
||||
/// JSON format
|
||||
Json,
|
||||
/// CSV format (edges and nodes)
|
||||
Csv,
|
||||
}
|
||||
Reference in New Issue
Block a user