< Summary - pva.SuperV

Information
Class: pva.SuperV.Engine.HistoryStorage.HistoryRepository
Assembly: pva.SuperV.Engine
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Engine/HistoryStorage/HistoryRepository.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
85%
Covered lines: 12
Uncovered lines: 2
Coverable lines: 14
Total lines: 76
Line coverage: 85.7%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%11100%
get_HistoryStorageEngine()100%11100%
get_HistoryStorageId()100%11100%
UpsertRepository(...)100%11100%
UpsertClassTimeSerie(...)50%2266.66%
HistorizeValues(...)50%22100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Engine/HistoryStorage/HistoryRepository.cs

#LineLine coverage
 1using pva.SuperV.Common;
 2using pva.SuperV.Engine.Exceptions;
 3using pva.SuperV.Engine.Processing;
 4using System.Text.Json.Serialization;
 5
 6namespace pva.SuperV.Engine.HistoryStorage
 7{
 8    /// <summary>
 9    /// History repository to store history of instance values.
 10    /// </summary>
 11    /// <param name="name">Name of the history repository.</param>
 17112    public class HistoryRepository(string name)
 13    {
 14        /// <summary>
 15        /// Gets the history repository name.
 16        /// </summary>
 17        /// <value>
 18        /// The name.
 19        /// </value>
 287920        public string Name { get; } = IdentifierValidation.ValidateIdentifier("history repository", name);
 21
 22        /// <summary>
 23        /// Gets or sets the history storage engine used to store values.
 24        /// </summary>
 25        /// <value>
 26        /// The history storage engine.
 27        /// </value>
 28        [JsonIgnore]
 372229        public IHistoryStorageEngine? HistoryStorageEngine { get; set; }
 30
 31        /// <summary>
 32        /// Gets of sets the history storage ID.
 33        /// </summary>
 34        /// <value> The history storage ID</value>
 193935        public string? HistoryStorageId { get; set; }
 36
 37        /// <summary>
 38        /// Upserts the repository in storage engine.
 39        /// </summary>
 40        /// <param name="projectName">Name of project.</param>
 41        /// <param name="historyStorageEngine">History storage engine.</param>
 42        internal void UpsertRepository(string projectName, IHistoryStorageEngine historyStorageEngine) =>
 11943            HistoryStorageId = historyStorageEngine.UpsertRepository(projectName, this);
 44
 45        /// <summary>
 46        /// Upserts a time series in storage engine.
 47        /// </summary>
 48        /// <param name="projectName">Name of project.</param>
 49        /// <param name="className">Name of class.</param>
 50        /// <param name="historizationProcessing">History processing for which the time series is to be created.</param>
 51        /// <returns>Class time serie ID in repository</returns>
 52        /// <exception cref="NoHistoryStorageEngineException"></exception>
 53        internal string UpsertClassTimeSerie(string projectName, string className, IHistorizationProcessing historizatio
 163554        {
 163555            if (HistoryStorageEngine is null)
 056            {
 057                throw new NoHistoryStorageEngineException();
 58            }
 163559            return HistoryStorageEngine.UpsertClassTimeSerie(HistoryStorageId!, projectName, className, historizationPro
 163460        }
 61
 62        /// <summary>
 63        /// Historize instance values in storage engine
 64        /// </summary>
 65        /// <param name="historizationProcessingName">The name of the historization processing.</param>
 66        /// <param name="classTimeSerieId">The time series ID.</param>
 67        /// <param name="instance">The instance.</param>
 68        /// <param name="timestamp">the timestamp of the values</param>
 69        /// <param name="quality">The quality level of the values.</param>
 70        /// <param name="fieldsToHistorize">List of fields to be historized.</param>
 71        public void HistorizeValues(string historizationProcessingName, string classTimeSerieId, IInstance instance, Dat
 9772        {
 9773            HistoryStorageEngine?.HistorizeValues(HistoryStorageId!, historizationProcessingName, classTimeSerieId, inst
 9774        }
 75    }
 76}