/// <summary> Two IndexCommits are equal if both their Directory and versions are equal.</summary> public override bool Equals(System.Object other) { if (other is IndexCommit) { IndexCommit otherCommit = (IndexCommit)other; return(otherCommit.GetDirectory().Equals(GetDirectory()) && otherCommit.GetVersion() == GetVersion()); } else { return(false); } }
private void VerifyCommitOrder(System.Collections.IList commits) { IndexCommit firstCommit = ((IndexCommit)commits[0]); long last = SegmentInfos.GenerationFromSegmentsFileName(firstCommit.GetSegmentsFileName()); Assert.AreEqual(last, firstCommit.GetGeneration()); long lastVersion = firstCommit.GetVersion(); long lastTimestamp = firstCommit.GetTimestamp(); for (int i = 1; i < commits.Count; i++) { IndexCommit commit = ((IndexCommit)commits[i]); long now = SegmentInfos.GenerationFromSegmentsFileName(commit.GetSegmentsFileName()); long nowVersion = commit.GetVersion(); long nowTimestamp = commit.GetTimestamp(); Assert.IsTrue(now > last, "SegmentInfos commits are out-of-order"); Assert.IsTrue(nowVersion > lastVersion, "SegmentInfos versions are out-of-order"); Assert.IsTrue(nowTimestamp >= lastTimestamp, "SegmentInfos timestamps are out-of-order: now=" + nowTimestamp + " vs last=" + lastTimestamp); Assert.AreEqual(now, commit.GetGeneration()); last = now; lastVersion = nowVersion; lastTimestamp = nowTimestamp; } }
public override long GetVersion() { return(cp.GetVersion()); }
public int GetVersion() { return((int)cp.GetVersion()); }