예제 #1
0
        /// <summary>
        ///     Compare and set the raw value of the tail for the given partition.
        /// </summary>
        /// <param name="metaDataBuffer"> containing the tail counters. </param>
        /// <param name="partitionIndex">    for the tail counter. </param>
        /// <param name="expectedRawTail">   expected current value. </param>
        /// <param name="updateRawTail">     to be applied. </param>
        /// <returns> true if the update was successful otherwise false. </returns>
        public static bool CasRawTail(UnsafeBuffer metaDataBuffer, int partitionIndex, long expectedRawTail, long updateRawTail)
        {
            var index = TERM_TAIL_COUNTERS_OFFSET + BitUtil.SIZE_OF_LONG * partitionIndex;

            return(metaDataBuffer.CompareAndSetLong(index, expectedRawTail, updateRawTail));
        }