/// <summary> /// /// </summary> /// <param name="settings"></param> public SnapServerDatabase(ServerDatabaseSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } m_settings = settings.CloneReadonly(); m_settings.Validate(); m_tmpKey = new TKey(); m_tmpValue = new TValue(); m_supportedStreamingMethods = settings.StreamingEncodingMethods.ToList(); m_info = new DatabaseInfo(m_settings.DatabaseName, m_tmpKey, m_tmpValue, m_supportedStreamingMethods); using (Logger.AppendStackMessages(GetSourceDetails())) { m_archiveList = new ArchiveList <TKey, TValue>(m_settings.ArchiveList); m_rolloverLog = new RolloverLog(m_settings.RolloverLog, m_archiveList); if (m_settings.SupportsWriting) { m_archiveWriter = new WriteProcessor <TKey, TValue>(m_archiveList, m_settings.WriteProcessor, m_rolloverLog); } } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="Editor"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (!m_disposed) { try { // This will be done regardless of whether the object is finalized or disposed. if (disposing) { m_disposed = true; m_list.m_listLog.SaveLogToDisk(); Monitor.Exit(m_list.m_syncRoot); m_list = null; } } finally { m_disposed = true; // Prevent duplicate dispose. base.Dispose(disposing); // Call base class Dispose(). } } }
/// <summary> /// Creates an editor for the ArchiveList /// </summary> /// <param name="list">the list to create the edit lock on.</param> public Editor(ArchiveList <TKey, TValue> list) { m_list = list; Monitor.Enter(m_list.m_syncRoot); }