Esempio n. 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);
        }
Esempio n. 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);
         }
     });
 }