//private int? _hiddenFailuresTolerated; //private float? _spatialDistributionOfRedundancy; /// <summary> /// Constructs an empty StatusResultsBuilder, ready to fill with properties, children, and alerts. /// </summary> /// <param name="targetSystem">The target system (if any apply at this level).</param> public StatusResultsBuilder(string targetSystem) { _targetSystem = targetSystem; _auditStartTime = AmbientClock.UtcNow; _relativeDetailLevel = 1; _natureOfSystem = StatusNatureOfSystem.ChildrenHeterogenous; }
/// <summary> /// Constructs an empty StatusResultsBuilder, ready to fill with properties, children, and alerts. /// <see cref="NatureOfSystem"/> start with a value of <see cref="StatusNatureOfSystem.ChildrenHeterogenous"/>. /// </summary> /// <param name="checker">The <see cref="StatusChecker"/> we are going to build results for.</param> public StatusResultsBuilder(StatusChecker checker) { if (checker == null) { throw new ArgumentNullException(nameof(checker)); } _targetSystem = checker.TargetSystem; _auditStartTime = AmbientClock.UtcNow; _relativeDetailLevel = 1; _natureOfSystem = StatusNatureOfSystem.ChildrenHeterogenous; }
/// <summary> /// Cosntructs a <see cref="StatusResults"/> including a summary report from the specified children. /// </summary> /// <param name="sourceSystem">The name of the source system (if known).</param> /// <param name="targetSystem">The name of the target system, or an empty string if these results are not associated with any particular named subsystem of the parent.</param> /// <param name="children">An enumeration of <see cref="StatusResults"/> for child nodes in the status tree.</param> public StatusResults(string?sourceSystem, string targetSystem, IEnumerable <StatusResults> children) { _sourceSystem = sourceSystem; _targetSystem = targetSystem; _time = AmbientClock.UtcNow; _relativeDetailLevel = 0; _properties = ImmutableArray <StatusProperty> .Empty; _natureOfSystem = StatusNatureOfSystem.ChildrenHeterogenous; _children = ImmutableArrayExtensions.FromEnumerable(children); _report = null; }
/// <summary> /// Cosntructs a <see cref="StatusResults"/> from the specified property data. /// </summary> /// <param name="sourceSystem">The name of the source system (if known).</param> /// <param name="targetSystem">The name of the target system, or an empty string if these results are not associated with any particular named subsystem of the parent.</param> /// <param name="time">The <see cref="DateTime"/> when the properties were gathered.</param> /// <param name="relativeDetailLevel">The relative level of detail provided by the properties at this level.</param> /// <param name="properties">An enumeration of <see cref="StatusProperty"/> indicating various properties of the system.</param> /// <param name="report">An optional <see cref="StatusAuditReport"/> containing the results of the most recent audit in case this is an auditable node.</param> public StatusResults(string?sourceSystem, string targetSystem, DateTime time, int relativeDetailLevel, IEnumerable <StatusProperty> properties, StatusAuditReport?report = null) { _sourceSystem = sourceSystem; _targetSystem = targetSystem; _time = time; _relativeDetailLevel = relativeDetailLevel; _properties = ImmutableArrayExtensions.FromEnumerable(properties); _report = report; _natureOfSystem = StatusNatureOfSystem.Leaf; _children = ImmutableArray <StatusResults> .Empty; }
/// <summary> /// Cosntructs a <see cref="StatusResults"/> from the specified property data. /// </summary> /// <param name="sourceSystem">The name of the source system (if known).</param> /// <param name="targetSystem">The name of the target system, or null or an empty string if these results are not associated with any particular named subsystem of the parent.</param> /// <param name="time">The <see cref="DateTime"/> when the properties were gathered.</param> /// <param name="relativeDetailLevel">The relative level of detail provided by the properties at this level.</param> /// <param name="properties">An enumeration of <see cref="StatusProperty"/> indicating various properties of the system.</param> /// <param name="natureOfSystem">A <see cref="StatusNatureOfSystem"/> indicating if or how audit results from children should be aggregated and how redundancy might be inferred.</param> /// <param name="children">An enumeration of <see cref="StatusResults"/> for child nodes in the status tree.</param> public StatusResults(string?sourceSystem, string?targetSystem, DateTime time, int relativeDetailLevel, IEnumerable <StatusProperty> properties, StatusNatureOfSystem natureOfSystem, IEnumerable <StatusResults> children) { _sourceSystem = sourceSystem; _targetSystem = targetSystem ?? ""; _time = time; _relativeDetailLevel = relativeDetailLevel; _properties = ImmutableArrayExtensions.FromEnumerable(properties); _report = null; _natureOfSystem = natureOfSystem; _children = ImmutableArrayExtensions.FromEnumerable(children); }
private StatusResults(string?sourceSystem, string targetSystem) { _sourceSystem = sourceSystem; _targetSystem = targetSystem; _time = AmbientClock.UtcNow; _relativeDetailLevel = 0; _natureOfSystem = StatusNatureOfSystem.Leaf; _properties = ImmutableArray <StatusProperty> .Empty; _children = ImmutableArray <StatusResults> .Empty; _report = StatusAuditReport.Pending; }
/// <summary> /// Constructs a StatusResultsBuilder from the specified <see cref="StatusResults"/>. /// </summary> /// <param name="results">The <see cref="StatusResults"/> to copy from.</param> public StatusResultsBuilder(StatusResults results) { if (results == null) { throw new ArgumentNullException(nameof(results)); } _sourceSystem = results.SourceSystem; _targetSystem = results.TargetSystem; _auditStartTime = results.Time; _relativeDetailLevel = results.RelativeDetailLevel; _natureOfSystem = results.NatureOfSystem; _worstAlert = (results.Report == null) ? null : results.Report.Alert; _nextAuditTime = (results.Report == null) ? null : results.Report.NextAuditTime; _properties = new List <StatusProperty>(results.Properties); _children = new List <StatusResultsBuilder>(results.Children.Select(c => new StatusResultsBuilder(c))); }