public void ShouldForceClaimSequence() { const long claimSequence = 3L; long sequence = _sequencer.Claim(claimSequence); Assert.AreEqual(Sequencer.InitialCursorValue, _sequencer.Cursor); Assert.AreEqual(sequence, claimSequence); _sequencer.ForcePublish(sequence); Assert.AreEqual(claimSequence, _sequencer.Cursor); }
public void ShouldClaimSpecificSequence() { long sequence = 14L; _sequencer.Claim(sequence); _sequencer.Publish(sequence); Assert.That(_sequencer.Next(), Is.EqualTo(sequence + 1)); }
/// <summary> /// Sets the cursor to a specific sequence and returns the pre-allocated entry that is stored there. This can cause a data race and should only be done in controlled circumstances, e.g.during initialisation. /// </summary> /// <param name="sequence">The sequence to claim.</param> /// <returns>The pre-allocated event.</returns> public TEvent ClaimAndGetPreAllocated(long sequence) { Sequencer.Claim(sequence); return(Get(sequence)); }