Exemple #1
0
 /// <summary>
 /// Replaces the existing settings with this new set.
 /// </summary>
 /// <param name="settings"></param>
 public void UpdateSettings(SimplifiedArchiveInitializerSettings settings)
 {
     settings = settings.CloneReadonly();
     settings.Validate();
     using (m_lock.EnterWriteLock())
     {
         m_settings = settings;
     }
 }
Exemple #2
0
        /// <summary>
        /// Creates a new <see cref="SortedTreeTable{TKey,TValue}"/> based on the settings passed to this class.
        /// Once created, it is up to he caller to make sure that this class is properly disposed of.
        /// </summary>
        /// <param name="startKey">the first key in the archive file</param>
        /// <param name="endKey">the last key in the archive file</param>
        /// <param name="estimatedSize">The estimated size of the file. -1 to ignore this feature and write to the first available directory.</param>
        /// <param name="archiveIdCallback">the archiveId to assign to the new file.</param>
        /// <returns></returns>
        public SortedTreeTable <TKey, TValue> CreateArchiveFile(TKey startKey, TKey endKey, long estimatedSize, TreeStream <TKey, TValue> data, Action <Guid> archiveIdCallback)
        {
            SimplifiedArchiveInitializerSettings settings = m_settings;

            string pendingFile = CreateArchiveName(GetPathWithEnoughSpace(estimatedSize), startKey, endKey);
            string finalFile   = Path.ChangeExtension(pendingFile, settings.FinalExtension);

            SortedTreeFileSimpleWriter <TKey, TValue> .Create(pendingFile, finalFile, 4096, archiveIdCallback, settings.EncodingMethod, data, settings.Flags.ToArray());

            return(SortedTreeFile.OpenFile(finalFile, true).OpenTable <TKey, TValue>());
        }
Exemple #3
0
 /// <summary>
 /// Creates a <see cref="ArchiveInitializer{TKey,TValue}"/>
 /// </summary>
 /// <param name="settings"></param>
 public SimplifiedArchiveInitializer(SimplifiedArchiveInitializerSettings settings)
 {
     m_settings = settings.CloneReadonly();
     m_settings.Validate();
     m_lock = new ReaderWriterLockEasy();
 }