refactor(core): 重构核心分层结构并添加发布库聚合
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
src/Gpulse.WCT.DataAnalyzer/Commands/AggregateCommand.cs
Normal file
33
src/Gpulse.WCT.DataAnalyzer/Commands/AggregateCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.CommandLine;
|
||||
using Gpulse.WCT.DataAnalyzer.Core.Application;
|
||||
|
||||
namespace Gpulse.WCT.DataAnalyzer.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// 从本地解析库生成正式发布库。
|
||||
/// </summary>
|
||||
public class AggregateCommand : Command
|
||||
{
|
||||
public AggregateCommand(AggregationService aggregationService)
|
||||
: base("aggregate", "Aggregate local log data into the release database")
|
||||
{
|
||||
var rebuildOption = new Option<bool>(
|
||||
"--rebuild",
|
||||
() => true,
|
||||
"Rebuild the release table before inserting aggregated records");
|
||||
AddOption(rebuildOption);
|
||||
|
||||
this.SetHandler(async rebuild =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var report = await aggregationService.AggregateAsync(rebuild);
|
||||
Console.WriteLine($"Aggregated {report.LocalRecordCount} local Ploss records into {report.ReleaseRecordCount} release records.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Aggregation failed: {ex.Message}");
|
||||
}
|
||||
}, rebuildOption);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user