예제 #1
0
        private static FreeListIdProvider GetFreelist(PagedFile pagedFile, TreeState treeState)
        {
            FreeListIdProvider freelist = new FreeListIdProvider(pagedFile, pagedFile.PageSize(), treeState.LastId(), FreeListIdProvider.NO_MONITOR);

            freelist.Initialize(treeState.LastId(), treeState.FreeListWritePageId(), treeState.FreeListReadPageId(), treeState.FreeListWritePos(), freelist.ReadPos());
            return(freelist);
        }
예제 #2
0
 public static IndexCorruption <KEY, VALUE> AddFreelistEntry <KEY, VALUE>(long releasedId)
 {
     return((pagedFile, layout, node, treeState) =>
     {
         FreeListIdProvider freelist = GetFreelist(pagedFile, treeState);
         freelist.ReleaseId(treeState.stableGeneration(), treeState.unstableGeneration(), releasedId);
         using (PageCursor cursor = pagedFile.io(0, PagedFile.PF_SHARED_WRITE_LOCK))
         {
             goTo(cursor, "", treeState.pageId());
             TreeState.Write(cursor, treeState.stableGeneration(), treeState.unstableGeneration(), treeState.rootId(), treeState.rootGeneration(), freelist.LastId(), freelist.WritePageId(), freelist.ReadPageId(), freelist.WritePos(), freelist.ReadPos(), treeState.Clean);
         }
     });
 }
예제 #3
0
 private void InitializeInstanceFields()
 {
     _freelist = new FreeListIdProvider(_pagedFile, PAGE_SIZE, BASE_ID, _monitor);
 }