From 5a101a60b36318adafe1752e4a52a4dcb6d9adf2 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 3 Jan 2026 08:59:57 -0500 Subject: [PATCH] feat(etl): add core ETL pipeline interfaces Add the four core interfaces for the ETL pipeline: - IImportSource: defines data sources for reading - IDataTransformer: defines data transformation layer - IImportDestination: defines data write destinations - IScriptRunner: defines script execution capability --- .../Etl/Contracts/IDataTransformer.cs | 21 ++++++++++++++++ .../Etl/Contracts/IImportDestination.cs | 25 +++++++++++++++++++ .../Etl/Contracts/IImportSource.cs | 21 ++++++++++++++++ .../Etl/Contracts/IScriptRunner.cs | 18 +++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 NEW/src/JdeScoping.DataSync/Etl/Contracts/IDataTransformer.cs create mode 100644 NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportDestination.cs create mode 100644 NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportSource.cs create mode 100644 NEW/src/JdeScoping.DataSync/Etl/Contracts/IScriptRunner.cs diff --git a/NEW/src/JdeScoping.DataSync/Etl/Contracts/IDataTransformer.cs b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IDataTransformer.cs new file mode 100644 index 0000000..f3ac31c --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IDataTransformer.cs @@ -0,0 +1,21 @@ +using System.Data; + +namespace JdeScoping.DataSync.Etl.Contracts; + +/// +/// Defines a transformer that can modify or enhance data during the ETL process. +/// +public interface IDataTransformer +{ + /// + /// Transforms the source data reader into a new data reader with modifications applied. + /// + /// The source data reader to transform. + /// A new IDataReader with transformations applied. + IDataReader Transform(IDataReader source); + + /// + /// Gets the name of this transformer for logging and identification. + /// + string TransformerName { get; } +} diff --git a/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportDestination.cs b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportDestination.cs new file mode 100644 index 0000000..cfa3348 --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportDestination.cs @@ -0,0 +1,25 @@ +using System.Data; +using JdeScoping.DataSync.Etl.Results; + +namespace JdeScoping.DataSync.Etl.Contracts; + +/// +/// Defines a destination to which data can be written during import operations. +/// +public interface IImportDestination +{ + /// + /// Writes data from the source reader to the destination asynchronously. + /// + /// The data reader containing the data to write. + /// Token to cancel the operation. + /// A result containing statistics about the write operation. + Task WriteAsync( + IDataReader source, + CancellationToken cancellationToken = default); + + /// + /// Gets the name of this destination for logging and identification. + /// + string DestinationName { get; } +} diff --git a/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportSource.cs b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportSource.cs new file mode 100644 index 0000000..81ff7f7 --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IImportSource.cs @@ -0,0 +1,21 @@ +using System.Data; + +namespace JdeScoping.DataSync.Etl.Contracts; + +/// +/// Defines a source from which data can be read for import operations. +/// +public interface IImportSource : IAsyncDisposable +{ + /// + /// Reads data from the source asynchronously. + /// + /// Token to cancel the operation. + /// An IDataReader providing access to the source data. + Task ReadDataAsync(CancellationToken cancellationToken = default); + + /// + /// Gets the name of this data source for logging and identification. + /// + string SourceName { get; } +} diff --git a/NEW/src/JdeScoping.DataSync/Etl/Contracts/IScriptRunner.cs b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IScriptRunner.cs new file mode 100644 index 0000000..0f4d73d --- /dev/null +++ b/NEW/src/JdeScoping.DataSync/Etl/Contracts/IScriptRunner.cs @@ -0,0 +1,18 @@ +namespace JdeScoping.DataSync.Etl.Contracts; + +/// +/// Defines a runner that can execute scripts as part of the ETL process. +/// +public interface IScriptRunner +{ + /// + /// Executes the script asynchronously. + /// + /// Token to cancel the operation. + Task ExecuteAsync(CancellationToken cancellationToken = default); + + /// + /// Gets the name of this script for logging and identification. + /// + string ScriptName { get; } +}