/// <summary> /// Initialise a channel for restarting a publication at a given position. /// </summary> /// <param name="position"> at which the publication should be started. </param> /// <param name="initialTermId"> what which the stream would start. </param> /// <param name="termLength"> for the stream. </param> public void InitialPosition(long position, int initialTermId, int termLength) { int bitsToShift = LogBufferDescriptor.PositionBitsToShift(termLength); int termId = LogBufferDescriptor.ComputeTermIdFromPosition(position, bitsToShift, initialTermId); int termOffset = (int)(position & (termLength - 1)); Put(Aeron.Context.INITIAL_TERM_ID_PARAM_NAME, Convert.ToString(initialTermId)); Put(Aeron.Context.TERM_ID_PARAM_NAME, Convert.ToString(termId)); Put(Aeron.Context.TERM_OFFSET_PARAM_NAME, Convert.ToString(termOffset)); Put(Aeron.Context.TERM_LENGTH_PARAM_NAME, Convert.ToString(termLength)); }
/// <summary> /// Initialise a channel for restarting a publication at a given position. /// </summary> /// <param name="position"> at which the publication should be started. </param> /// <param name="initialTermId"> what which the stream would start. </param> /// <param name="termLength"> for the stream. </param> /// <returns> this for a fluent API. </returns> public ChannelUriStringBuilder InitialPosition(long position, int initialTermId, int termLength) { int bitsToShift = LogBufferDescriptor.PositionBitsToShift(termLength); _initialTermId = initialTermId; _termId = LogBufferDescriptor.ComputeTermIdFromPosition(position, bitsToShift, initialTermId); _termOffset = (int)(position & (termLength - 1)); _termLength = termLength; return(this); }
/// <summary> /// Initialise a channel for restarting a publication at a given position. /// </summary> /// <param name="position"> at which the publication should be started. </param> /// <param name="initialTermId"> what which the stream would start. </param> /// <param name="termLength"> for the stream. </param> public void InitialPosition(long position, int initialTermId, int termLength) { if (position < 0 || 0 != (position & (FrameDescriptor.FRAME_ALIGNMENT - 1))) { throw new ArgumentException("invalid position: " + position); } int bitsToShift = LogBufferDescriptor.PositionBitsToShift(termLength); int termId = LogBufferDescriptor.ComputeTermIdFromPosition(position, bitsToShift, initialTermId); int termOffset = (int)(position & (termLength - 1)); Put(Aeron.Context.INITIAL_TERM_ID_PARAM_NAME, Convert.ToString(initialTermId)); Put(Aeron.Context.TERM_ID_PARAM_NAME, Convert.ToString(termId)); Put(Aeron.Context.TERM_OFFSET_PARAM_NAME, Convert.ToString(termOffset)); Put(Aeron.Context.TERM_LENGTH_PARAM_NAME, Convert.ToString(termLength)); }
/// <summary> /// Initialise a channel for restarting a publication at a given position. /// </summary> /// <param name="position"> at which the publication should be started. </param> /// <param name="initialTermId"> what which the stream would start. </param> /// <param name="termLength"> for the stream. </param> /// <returns> this for a fluent API. </returns> public ChannelUriStringBuilder InitialPosition(long position, int initialTermId, int termLength) { if (position < 0 || 0 != (position & (FRAME_ALIGNMENT - 1))) { throw new ArgumentException("invalid position: " + position); } int bitsToShift = LogBufferDescriptor.PositionBitsToShift(termLength); _initialTermId = initialTermId; _termId = LogBufferDescriptor.ComputeTermIdFromPosition(position, bitsToShift, initialTermId); _termOffset = (int)(position & (termLength - 1)); _termLength = termLength; return(this); }