Ejemplo n.º 1
0
        /// <summary>
        /// Constructor for unit testing
        /// </summary>
        internal FileCombiner(LoggingContext loggingContext, string path, FileCombinerUsage usage, double allowableUnreferencedRatio, int maxReadChunkBytes)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(path));
            Contract.Requires(maxReadChunkBytes > 0 && maxReadChunkBytes <= DefaultMaxReadChunkBytes);

            m_path                       = path;
            m_usage                      = usage;
            m_loggingContext             = loggingContext;
            m_allowableUnreferencedRatio = allowableUnreferencedRatio;
            m_maxReadChunkBytes          = maxReadChunkBytes;
            m_initializationTask         = Task.Factory.StartNew(Initialize);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new FileCombiner
 /// </summary>
 /// <param name="loggingContext">The LoggingContext</param>
 /// <param name="path">Path of the backing file</param>
 /// <param name="usage">Identifies the use application of the FileCombiner</param>
 /// <param name="logFileCombinerStatistics">This class logs a bunch of stats at dispose time. This flag controls wether this happens.</param>
 /// <param name="allowableUnreferencedRatio">Ratio of bytes that are allowed to not be referenced without
 /// compacting the file. If 100 bytes are in the structure and the ratio is .2, then the structure will be compacted to
 /// remove unreferenced items if more than 20 unique bytes are not retrieved during the lifetime of the object.</param>
 public FileCombiner(LoggingContext loggingContext, string path, FileCombinerUsage usage, bool logFileCombinerStatistics, double allowableUnreferencedRatio = .2)
     : this(loggingContext, path, usage, allowableUnreferencedRatio, DefaultMaxReadChunkBytes)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(path));
     m_logFileCombinerStatistics = logFileCombinerStatistics;
 }