From 4213c3ef9d63866bf1e29d635168341f9a6c8067 Mon Sep 17 00:00:00 2001 From: Rory Reid Date: Thu, 28 Sep 2023 22:24:27 +0100 Subject: [PATCH] Remove unused parsed output from docker top This removes the need to parse all output from docker top, preventing parsing errors where format of columns may differ from host to host. **Warning:** This could potentially break client code, if any client actively relies on the public method: - IContainerService.DockerHost.Top(...).Processes.Rows --- .../Model/Containers/ProcessRow.cs | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/Ductus.FluentDocker/Model/Containers/ProcessRow.cs b/Ductus.FluentDocker/Model/Containers/ProcessRow.cs index c9e5ed3..0116045 100644 --- a/Ductus.FluentDocker/Model/Containers/ProcessRow.cs +++ b/Ductus.FluentDocker/Model/Containers/ProcessRow.cs @@ -25,17 +25,7 @@ public sealed class ProcessRow private const string StartConst = "START"; private const string CmdConstWin = "Name"; - public string User { get; internal set; } - public long Pid { get; internal set; } - public long ProcessPid { get; internal set; } public string Command { get; internal set; } - public string Tty { get; internal set; } - public TimeSpan Time { get; internal set; } - public TimeSpan Started { get; internal set; } - public string Status { get; internal set; } - public float PercentCpuUtilization { get; internal set; } - public TimeSpan Cpu { get; private set; } - public float PercentMemoryUtilization { get; internal set; } public IList FullRow { get; internal set; } internal static ProcessRow ToRow(IList columns, IList fullRow) @@ -53,39 +43,6 @@ internal static ProcessRow ToRow(IList columns, IList fullRow) case CmdConstWin: row.Command = fullRow[i]; break; - case UserConst: - case UidConst: - row.User = fullRow[i]; - break; - case PidConst: - row.Pid = long.Parse(fullRow[i]); - break; - case PpidConst: - row.ProcessPid = long.Parse(fullRow[i]); - break; - case StartConst: - case StartTimeConst: - row.Started = TimeSpan.Parse(fullRow[i]); - break; - case TimeConst: - row.Time = TimeSpan.Parse(fullRow[i]); - break; - case TerminalConst: - row.Tty = fullRow[i]; - break; - case StatConst: - row.Status = fullRow[i]; - break; - case CpuTime: - if (TimeSpan.TryParse(fullRow[i], out var cpuTime)) - row.Cpu = cpuTime; - break; - case PercentCpuConst: - row.PercentCpuUtilization = float.Parse(fullRow[i], CultureInfo.InvariantCulture.NumberFormat); - break; - case PercentMemoryConst: - row.PercentMemoryUtilization = float.Parse(fullRow[i], CultureInfo.InvariantCulture.NumberFormat); - break; } }