/// <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();
            }
        }
            private void ConcludeMarkFile()
            {
                if (null == markFile)
                {
                    int alignedTotalCncFileLength = ClusterMarkFile.AlignedTotalFileLength(
                        ClusterMarkFile.ALIGNMENT,
                        aeron.Ctx().AeronDirectoryName(),
                        archiveContext.ControlRequestChannel(),
                        ServiceControlChannel(),
                        null,
                        serviceName,
                        null);

                    markFile = new ClusterMarkFile(
                        new FileInfo(Path.Combine(clusteredServiceDir.FullName, ClusterMarkFile.FILENAME)),
                        ClusterComponentType.CONTAINER,
                        alignedTotalCncFileLength,
                        epochClock,
                        0);

                    MarkFileHeaderEncoder cncEncoder = markFile.Encoder();

                    cncEncoder
                    .ArchiveStreamId(archiveContext.ControlRequestStreamId())
                    .ServiceControlStreamId(serviceControlStreamId)
                    .IngressStreamId(0)
                    .MemberId(-1)
                    .ServiceId(serviceId)
                    .AeronDirectory(aeron.Ctx().AeronDirectoryName())
                    .ArchiveChannel(archiveContext.ControlRequestChannel())
                    .ServiceControlChannel(serviceControlChannel)
                    .IngressChannel("")
                    .ServiceName(serviceName)
                    .Authenticator("");

                    markFile.UpdateActivityTimestamp(epochClock.Time());
                    markFile.SignalReady();
                }
            }
Beispiel #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?
 }
Beispiel #4
0
 public void MemberId(int memberId)
 {
     buffer.PutIntVolatile(MarkFileHeaderEncoder.MemberIdEncodingOffset(), memberId);
     markFile.MappedByteBuffer().Flush();
 }
Beispiel #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();
 }
 public void ClusterId(int clusterId)
 {
     buffer.PutInt(MarkFileHeaderEncoder.ClusterIdEncodingOffset(), clusterId);
 }
 public void MemberId(int memberId)
 {
     buffer.PutIntVolatile(MarkFileHeaderEncoder.MemberIdEncodingOffset(), memberId);
 }