private Manifest.ManifestRecord Search(Manifest.StopHere stopHere) { ManifestBlock rootBlock = this.rootBlock; ManifestRecord tailRecord = ManifestRecord.TailRecord; while (true) { ManifestRecord record2 = null; bool flag = false; foreach (ManifestRecord record3 in new List <ManifestRecord>(rootBlock) { tailRecord }) { if (stopHere(record3.path)) { if ((record2 == null) || (record2.indirectManifestBlockId < 0)) { return(record3); } rootBlock = this.FetchBlock(record2.indirectManifestBlockId); tailRecord = record3; flag = true; break; } record2 = record3; } if (!flag) { D.Assert(false, "Should have stopped inside loop."); } } }
internal ManifestRecord FindFirstEqual(string path) { ManifestRecord manifestRecord = FindFirstGreaterEqual(path); if (manifestRecord.path == path) { return(manifestRecord); } return(ManifestRecord.TailRecord); }
public void Remove(string p) { ManifestRecord manifestRecord = FindFirstEqual(p); if (manifestRecord.IsTailRecord) { return; } manifestRecord.fileExists = false; manifestRecord.fileLength = -1L; }
internal void Add(string path, long fileLength) { ManifestRecord manifestRecord = FindFirstGreaterEqual(path); if (manifestRecord.path == path) { manifestRecord.fileExists = true; manifestRecord.fileLength = fileLength; return; } ManifestBlock manifestBlock = manifestRecord.block == null ? rootBlock : manifestRecord.block; ManifestRecord newRecord = new ManifestRecord(manifestBlock, path, true, fileLength, -1); manifestBlock.Insert(newRecord, manifestRecord); if (manifestBlock.Count > rootBlock.superBlock.splitThreshold) { manifestBlock.Split(new ManifestBlock.CreateBlock(CreateBlock)); } }