public MGIndex(string path, string filename, byte keysize, bool allowdups) { if (Global.UseLessMemoryStructures) { _cache = new SafeSortedList <int, Page <T> >(); } else { _cache = new SafeDictionary <int, Page <T> >(); } _AllowDuplicates = allowdups; if (path.EndsWith(Path.DirectorySeparatorChar.ToString()) == false) { path += Path.DirectorySeparatorChar; } _index = new IndexFile <T>(path + filename, keysize); // load page list _index.GetPageList(_pageListDiskPages, _pageList, out _LastIndexedRecordNumber); if (_pageList.Count() == 0) { Page <T> page = new Page <T>(); page.FirstKey = (T)RDBDataType <T> .GetEmpty(); page.DiskPageNumber = _index.GetNewPageNumber(); page.isDirty = true; _pageList.Add(page.FirstKey, new PageInfo(page.DiskPageNumber, 0, 0)); _cache.Add(page.DiskPageNumber, page); } }
public int GetFreeRecordNumber() { using (new L(this)) { int i = _lastRecordNumber++; _cache.Add(i, new WAHBitArray()); return(i); } }
public void Set(int index, bool val) { lock (_lock) { if (_state == TYPE.Indexes) { isDirty = true; if (val == true) { _offsets.Add((uint)index, true); // set max if (index > _curMax) { _curMax = (uint)index; } } else { _offsets.Remove((uint)index); } ChangeTypeIfNeeded(); return; } CheckBitArray(); Resize(index); internalSet(index, val); } }