private void DeallocateNode(ServerProcess AProcess, StreamID AStreamID) { using (IndexNode LIndexNode = new IndexNode(AProcess, this, AStreamID)) { for (int LEntryIndex = LIndexNode.EntryCount - 1; LEntryIndex >= 0; LEntryIndex--) { if (LIndexNode.NodeType == IndexNodeType.Routing) { if (LEntryIndex > 0) { DisposeKey(AProcess, LIndexNode.Key(LEntryIndex)); } DeallocateNode(AProcess, IndexUtility.GetStreamID(LIndexNode.Data(LEntryIndex), 0)); } else { DisposeKey(AProcess, LIndexNode.Key(LEntryIndex)); DisposeData(AProcess, LIndexNode.Data(LEntryIndex)); if (LIndexNode.NextNode == StreamID.Null) { FTailID = LIndexNode.PriorNode; } else { using (IndexNode LNextNode = new IndexNode(AProcess, this, LIndexNode.NextNode)) { LNextNode.PriorNode = LIndexNode.PriorNode; } } if (LIndexNode.PriorNode == StreamID.Null) { FHeadID = LIndexNode.NextNode; } else { using (IndexNode LPriorNode = new IndexNode(AProcess, this, LIndexNode.PriorNode)) { LPriorNode.NextNode = LIndexNode.NextNode; } } } } } AProcess.StreamManager.Deallocate(AStreamID); }
public void Prior() { CheckActive(); bool LEOF = FEOF; if (FDirection == ScanDirection.Forward) { if (FEOF) { FEOF = false; } else { FEntryNumber--; } if (((FEntryNumber < 0) || (FIndexNode.EntryCount == 0)) && !PriorNode()) { FEntryNumber = 0; FBOF = true; } // Make sure that the entry is >= FFirstKey if (!FBOF && (FFirstKey != null) && (FAccessPath.Compare(FProcess, FIndexNode.Key(FEntryNumber), null, FFirstKey.Stream, FFirstKey.DataType) < 0)) { First(); } } else { if (FEOF) { FEOF = false; } else { FEntryNumber++; } if ((FEntryNumber >= FIndexNode.EntryCount) && !NextNode()) { FEntryNumber = FIndexNode.EntryCount - 1; FEntryNumber = FEntryNumber < 0 ? 0 : FEntryNumber; FBOF = true; } // Make sure that the entry is <= FFirstKey if (!FBOF && (FFirstKey != null) && (FAccessPath.Compare(FProcess, FIndexNode.Key(FEntryNumber), null, FFirstKey.Stream, FFirstKey.DataType) > 0)) { First(); } } // Make sure that if the scan is empty, the EOF flag is still true if (LEOF && FBOF) { FEOF = true; } }