Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Net4.8/Example1-BasicETL/ETL/ConsoleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items)
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ internal class IntToStringTransformer : ITransformAsync<int, string>
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items)
{
Console.WriteLine($"Transforming integer {item} to string.");
await Task.Delay(50); // Simulate some delay for transformation
yield return item.ToString();
}

Console.WriteLine($"{ConsoleColors.Green}Transformation{ConsoleColors.Reset} completed.\n");
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/Net4.8/Example1-BasicETL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static async Task Main()
var loader = new ConsoleLoader();

Console.WriteLine($"{ConsoleColors.Yellow} Starting ETL process...{ConsoleColors.Reset}\n\n");

var sourceItems = extractor.ExtractAsync();
var transformedItems = transformer.TransformAsync(sourceItems);
await loader.LoadAsync(transformedItems);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Example2_WithCancellationToken
namespace Example2_WithCancellationToken
{
internal class ConsoleColors
{
Expand All @@ -7,4 +7,4 @@ internal class ConsoleColors
public const string Reset = "\u001b[0m";
public const string Red = "\u001b[31m";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items, CancellationToken to
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50, token); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items, [EnumeratorCancellation] CancellationToken token)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items.WithCancellation(token))
{
// Throw exception if cancellation is requested
Expand All @@ -39,7 +39,7 @@ public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items
await Task.Delay(50, token); // Simulate some delay for transformation
yield return item.ToString();
}

Console.WriteLine($"{ConsoleColors.Green}Transformation{ConsoleColors.Reset} completed.\n");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Example3_WithGracefulCancellation
namespace Example3_WithGracefulCancellation
{
internal class ConsoleColors
{
Expand All @@ -7,4 +7,4 @@ internal class ConsoleColors
public const string Reset = "\u001b[0m";
public const string Red = "\u001b[31m";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items, CancellationToken to
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50, token); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items, [EnumeratorCancellation] CancellationToken token)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items.WithCancellation(token))
{
if (token.IsCancellationRequested)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static async Task Main()
var token = cts.Token;

var sourceItems = extractor.ExtractAsync(token);
var transformedItems = transformer.TransformAsync(sourceItems,token);
var transformedItems = transformer.TransformAsync(sourceItems, token);
await loader.LoadAsync(transformedItems, token);

Console.WriteLine($"\n\n{ConsoleColors.Yellow}ETL process completed.{ConsoleColors.Reset}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace Example4a_WithExtractorProgress
{
internal class ConsoleColors
{
public const string Green = "\e[32m";
public const string Green = "\e[32m";
public const string Yellow = "\e[33m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4a_WithExtractorProgress.ETL;

internal class ConsoleLoader : ILoadWithProgressAsync<string, EtlProgress>
{

Expand Down Expand Up @@ -39,7 +40,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items)
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4a_WithExtractorProgress.ETL;

internal class FibonacciExtractor : IExtractAsync<int>, IExtractWithProgressAsync<int, EtlProgress>
{
private int _progressInterval = 1_000;
Expand Down Expand Up @@ -55,7 +56,7 @@ public async IAsyncEnumerable<int> ExtractAsync(IProgress<EtlProgress> progress)

var count = 0;
using var timer = new Timer
(
(
_ => progress.Report(new EtlProgress(Volatile.Read(ref count))),
state: null,
TimeSpan.Zero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using Wolfgang.Etl.Abstractions;

namespace Example4a_WithExtractorProgress.ETL;
internal class IntToStringTransformer

internal class IntToStringTransformer
: ITransformAsync<int, string>, ITransformWithProgressAsync<int, string, EtlProgress>
{

Expand Down Expand Up @@ -33,14 +34,14 @@ public int ProgressInterval
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items)
{
Console.WriteLine($"Transforming integer {item} to string.");
await Task.Delay(50); // Simulate some delay for transformation
yield return item.ToString();
}

Console.WriteLine($"{ConsoleColors.Green}Transformation{ConsoleColors.Reset} completed.\n");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System;
using System.Threading.Tasks;
using Example4a_WithExtractorProgress.ETL;

namespace Example4a_WithExtractorProgress;

internal class Program
{
private static async Task Main()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace Example4b_WithTransformerProgress
{
internal static class ConsoleColors
{
public const string Green = "\e[32m";
public const string Green = "\e[32m";
public const string Yellow = "\e[33m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4b_WithTransformerProgress.ETL;

internal class ConsoleLoader : ILoadAsync<string>, ILoadWithProgressAsync<string, EtlProgress>
{

Expand Down Expand Up @@ -39,7 +40,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items)
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4b_WithTransformerProgress.ETL;

internal class FibonacciExtractor : IExtractAsync<int>, IExtractWithProgressAsync<int, EtlProgress>
{
private int _progressInterval = 1_000;
Expand Down Expand Up @@ -55,7 +56,7 @@ public async IAsyncEnumerable<int> ExtractAsync(IProgress<EtlProgress> progress)

var count = 0;
using var timer = new Timer
(
(
_ => progress.Report(new EtlProgress(Volatile.Read(ref count))),
state: null,
TimeSpan.Zero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using Wolfgang.Etl.Abstractions;

namespace Example4b_WithTransformerProgress.ETL;
internal class IntToStringTransformer

internal class IntToStringTransformer
: ITransformAsync<int, string>, ITransformWithProgressAsync<int, string, EtlProgress>
{

Expand Down Expand Up @@ -33,14 +34,14 @@ public int ProgressInterval
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items)
{
Console.WriteLine($"Transforming integer {item} to string.");
await Task.Delay(50); // Simulate some delay for transformation
yield return item.ToString();
}

Console.WriteLine($"{ConsoleColors.Green}Transformation{ConsoleColors.Reset} completed.\n");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System;
using System.Threading.Tasks;
using Example4b_WithTransformerProgress.ETL;

namespace Example4b_WithTransformerProgress;

internal class Program
{
private static async Task Main()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ namespace Example4c_WithLoaderProgress
{
internal class ConsoleColors
{
public const string Green = "\e[32m";
public const string Green = "\e[32m";
public const string Yellow = "\e[33m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
public const string Reset = "\e[0m";
public const string Red = "\e[31m";
public const string Cyan = "\e[36m";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4c_WithLoaderProgress.ETL;

internal class ConsoleLoader : ILoadWithProgressAsync<string, EtlProgress>
{

Expand Down Expand Up @@ -39,7 +40,7 @@ public async Task LoadAsync(IAsyncEnumerable<string> items)
Console.WriteLine($"Loading item: {item}\n");
await Task.Delay(50); // Simulate some delay for loading
}

Console.WriteLine($"{ConsoleColors.Green}Loading{ConsoleColors.Reset} completed.\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Wolfgang.Etl.Abstractions;

namespace Example4c_WithLoaderProgress.ETL;

internal class FibonacciExtractor : IExtractAsync<int>, IExtractWithProgressAsync<int, EtlProgress>
{
private int _progressInterval = 1_000;
Expand Down Expand Up @@ -56,7 +57,7 @@ public async IAsyncEnumerable<int> ExtractAsync(IProgress<EtlProgress> progress)
var count = 0;

using var timer = new Timer
(
(
_ => progress.Report(new EtlProgress(Volatile.Read(ref count))),
state: null,
TimeSpan.Zero,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using Wolfgang.Etl.Abstractions;

namespace Example4c_WithLoaderProgress.ETL;
internal class IntToStringTransformer

internal class IntToStringTransformer
: ITransformAsync<int, string>, ITransformWithProgressAsync<int, string, EtlProgress>
{

Expand Down Expand Up @@ -33,14 +34,14 @@ public int ProgressInterval
public async IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<int> items)
{
Console.WriteLine($"{ConsoleColors.Green}Transforming{ConsoleColors.Reset} integers to strings asynchronously...\n");

await foreach (var item in items)
{
Console.WriteLine($"Transforming integer {item} to string.");
await Task.Delay(50); // Simulate some delay for transformation
yield return item.ToString();
}

Console.WriteLine($"{ConsoleColors.Green}Transformation{ConsoleColors.Reset} completed.\n");
}

Expand Down
Loading
Loading