示例#1
0
        public void IsCleverInFindingLastWhenOneExistsWithOneFinal()
        {
            var index = 42L;
            var term  = 2L;

            File.WriteAllText(_mgr.GetFinalFileNameForIndexAndTerm(index, term), "");
            var ss = _mgr.GetLastSnapshot();

            Assert.NotNull(ss);
            Assert.Equal(index, ss.LastIncludedIndex);
            Assert.Equal(term, ss.LastIncludedTerm);
        }
示例#2
0
 /// <inheritdocs/>
 public void FinaliseSnapshot(long lastIndexIncluded, long lastTerm)
 {
     File.Move(
         _snapMgr.GetTempFileNameForIndexAndTerm(lastIndexIncluded, lastTerm),
         _snapMgr.GetFinalFileNameForIndexAndTerm(lastIndexIncluded, lastTerm));
     this.LogOffset = lastIndexIncluded + 1; // this is it! if server goes down, it will find LogOffset from file names
 }