예제 #1
0
        /// <summary>
        /// Record the fact that a node has voted in a current election for a candidate so it can survive a restart.
        /// </summary>
        /// <param name="candidateTermId"> to record that a vote has taken place. </param>
        /// <param name="fileSyncLevel"> as defined by cluster file sync level.</param>
        public void CandidateTermId(long candidateTermId, int fileSyncLevel)
        {
            buffer.PutLongVolatile(MarkFileHeaderEncoder.CandidateTermIdEncodingOffset(), candidateTermId);

            if (fileSyncLevel > 0)
            {
                markFile.MappedByteBuffer().Flush();
            }
        }
예제 #2
0
 /// <summary>
 ///     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="rawTail">           to be stored </param>
 public static void RawTailVolatile(UnsafeBuffer metaDataBuffer, int partitionIndex, long rawTail)
 {
     metaDataBuffer.PutLongVolatile(TERM_TAIL_COUNTERS_OFFSET + BitUtil.SIZE_OF_LONG * partitionIndex,
                                    rawTail);
 }
예제 #3
0
 /// <summary>
 /// Record the fact that a node has voted in a current election for a candidate so it can survive a restart.
 /// </summary>
 /// <param name="candidateTermId"> to record that a vote has taken place. </param>
 public void CandidateTermId(long candidateTermId)
 {
     buffer.PutLongVolatile(MarkFileHeaderEncoder.CandidateTermIdEncodingOffset(), candidateTermId);
     //markFile.MappedByteBuffer().Force(); How to do this?
 }
 public void SetVolatile(long value)
 {
     _buffer.PutLongVolatile(_offset, value);
 }
예제 #5
0
 /// <summary>
 /// Record the fact that a node has voted in a current election for a candidate so it can survive a restart.
 /// </summary>
 /// <param name="candidateTermId"> to record that a vote has taken place. </param>
 public void CandidateTermId(long candidateTermId)
 {
     buffer.PutLongVolatile(MarkFileHeaderEncoder.CandidateTermIdEncodingOffset(), candidateTermId);
     markFile.MappedByteBuffer().Flush();
 }