public DiskTreeNodeManager(ISerializer <K> keySerializer, ISerializer <V> valueSerializer,
                                   IRecordStorage recordStorage, IComparer <K> keyComparer, DiskNodeOptions options = null)
        {
            if (recordStorage == null)
            {
                throw new ArgumentNullException("recordStorage");
            }
            if (options == null)
            {
                options = new DiskNodeOptions();
            }

            this.recordStorage = recordStorage;
            this.dirtyNodes    = new Dictionary <uint, TreeNode <K, V> >();
            this.weakNodes     = new Dictionary <uint, WeakReference <TreeNode <K, V> > >();
            this.strongNodes   = new Queue <TreeNode <K, V> >();
            this.serializer    = new DiskTreeNodeSerializer <K, V>(this, keySerializer, valueSerializer);
            this.keyComparer   = keyComparer;
            this.entryComparer = new TreeEntryComparer <K, V>(keyComparer);

            this.weakNodeCleanThreshold = options.WeakNodeCleanInterval;
            this.maxStrongNodes         = options.MaxStrongNode;
            this.minEntriesPerNode      = options.MinEntriesPerNode;

            this.deleteIds      = new List <uint>(weakNodeCleanThreshold / 2);
            this.cleanupCounter = 0;

            // Find or create the root node.
            var firstData = recordStorage.Find(1U);

            if (firstData != null)
            {
                this.rootNode = Find(BufferHelper.ReadUInt32(firstData, 0));
            }
            else
            {
                this.rootNode = CreateFirstRoot();
            }
        }
 public DiskTreeNodeManager(ISerializer <K> keySerializer, ISerializer <V> valueSerializer,
                            IRecordStorage recordStorage, DiskNodeOptions options = null) :
     this(keySerializer, valueSerializer, recordStorage, Comparer <K> .Default, options)
 {
 }