Skip to content

Commit eb231f8

Browse files
committed
Release 1.5
1 parent a9bebd9 commit eb231f8

File tree

15 files changed

+45
-4
lines changed

15 files changed

+45
-4
lines changed

Deployment/!!!Raft.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata>
44
<id>Raft</id>
5-
<version>1.4.0</version>
5+
<version>1.5.0</version>
66
<title>Raft.NET dotnet consensus algorithm implementation</title>
77
<authors>Alex Solovyov</authors>
88
<owners>tiesky.com / Alex Solovyov</owners>
@@ -11,7 +11,7 @@
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>Implementation of the RAFT consensus algorithm among TCP peers with disk or memory persistence</description>
1313
<summary>Raft.NET dotnet consensus algorithm implementation</summary>
14-
<releaseNotes>fixed and optimized In-Memory implementation, added async implementation AddLogEntryAsync</releaseNotes>
14+
<releaseNotes>raftNodeInstance.NodeIsInLatestState can help to understand if started node is in the latest update state</releaseNotes>
1515
<copyright>Copyright © 2018 tiesky.com / Alex Solovyov</copyright>
1616
<language>es-US</language>
1717
<tags>RAFT Raft.NET dotnet dbreeze netcore netstandard net framework</tags>

Deployment/Raft.1.5.0.nupkg

149 KB
Binary file not shown.

Raft/RaftNode.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,29 @@ public AddLogEntryResult AddLogEntry(byte[] iData, byte[] externalId = null)
12201220
return res;
12211221
}
12221222

1223+
/// <summary>
1224+
/// NodeIsInLatestState
1225+
/// </summary>
1226+
public bool NodeIsInLatestState
1227+
{
1228+
get
1229+
{
1230+
lock (lock_Operations)
1231+
{
1232+
if (this.NodeState == eNodeState.Leader)
1233+
return true;
1234+
else
1235+
{
1236+
if (this.LeaderHeartbeat == null)
1237+
return false;
1238+
1239+
return this.NodeStateLog.LastCommittedIndex == this.LeaderHeartbeat.LastStateLogCommittedIndex;
1240+
}
1241+
}
1242+
1243+
}
1244+
}
1245+
12231246

12241247
int inCommit = 0;
12251248

@@ -1253,7 +1276,9 @@ internal void Commited()
12531276

12541277
try
12551278
{
1256-
1279+
////if (this.LeaderHeartbeat != null)
1280+
//// Console.WriteLine($"LCIT={this.NodeStateLog.LastCommittedIndex}/{this.NodeStateLog.LastBusinessLogicCommittedIndex}/---{this.LeaderHeartbeat.LastStateLogCommittedIndex} ");
1281+
12571282

12581283
if (this.OnCommit(entitySettings.EntityName, sle.Index, sle.Data))
12591284
{
@@ -1263,6 +1288,7 @@ internal void Commited()
12631288
this.NodeStateLog.BusinessLogicIsApplied(sle.Index);
12641289
}
12651290

1291+
12661292
//Notifying Async AddLog
12671293
if (sle.ExternalID != null && AsyncResponseHandler.df.TryGetValue(sle.ExternalID.ToBytesString(), out var responseCrate))
12681294
{

Raft/_NodeTest/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static void Scenario1(string[] args)
160160

161161
rn = TcpRaftNode.GetFromConfig(System.IO.File.ReadAllText(args[2]),
162162
dbreezePath, Convert.ToInt32(args[1]), log,
163-
(entName, index, data) => { Console.WriteLine($"wow committed {entName}/{index}; DataLen: {(data == null ? -1 : data.Length)}"); return true; });
163+
(entName, index, data) => { Console.WriteLine($"wow committed {entName}/{index}; DataLen: {(data == null ? -1 : data.Length)};"); return true; });
164164

165165

166166

Raft/_NodeTest/bin/Debug/Raft.dll

0 Bytes
Binary file not shown.

Raft/_NodeTest/bin/Debug/Raft.pdb

2 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Raft/bin/Release-NET47/Raft.dll

0 Bytes
Binary file not shown.

Raft/bin/Release-NET47/Raft.pdb

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)