Skip to content

Commit

Permalink
Merge pull request microsoft#15 from microsoft/nuget
Browse files Browse the repository at this point in the history
Use nuget for IronRSLClient functionality
  • Loading branch information
jaylorch authored Jun 11, 2021
2 parents 996b2c1 + e962efb commit d7dc895
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 25 deletions.
4 changes: 2 additions & 2 deletions ironfleet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ console:
dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4001
dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4002
dotnet src/IronSHTServer/bin/Release/net5.0/IronSHTServer.dll localhost:4001 localhost:4002 localhost:4003 localhost:4003
dotnet src/IronSHTClient/bin/Release/net5.0/IronSHTClient.dll nthreads=10 duration=30 workload=g numkeys=10000 client=localhost:6000 verbose=true
dotnet src/IronSHTClient/bin/Release/net5.0/IronSHTClient.dll nthreads=10 duration=30 workload=g numkeys=10000 clientport=6000 verbose=true
```

The client will print its output to standard output. If you use
Expand Down Expand Up @@ -228,7 +228,7 @@ where you fill out the ellipses to provide:
Your client implementation, like in `src/IronRSLKVClient/Client.cs`, will
create a connection to the replicated service with:
```
RSLClient rslClient = new RSLClient(serverEndpoints, myClientEndpoint);
RSLClient rslClient = new RSLClient(serverEndpoints, myPortNumber);
```
and submit requests to that replicated service with:
```
Expand Down
18 changes: 18 additions & 0 deletions ironfleet/src/IronRSLClient/IronRSLClient.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageId>IronRSLClient</PackageId>
<Version>1.0.2</Version>
<Authors>Jay Lorch and Chris Hawblitzel</Authors>
<Company>Microsoft Corporation</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\IronfleetCommon\Networking.cs" />
<Compile Include="..\Dafny\Distributed\Common\Native\IoFramework.cs" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions ironfleet/src/IronRSLClient/IronRSLClient.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IronRSLClient", "IronRSLClient.csproj", "{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0AC4042E-CFAF-41AD-86DD-C91B39D06CB5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AFC77FFD-EE03-4482-A506-7F4B3A3B4431}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
using System.Linq;
using System.Net;

namespace IronfleetCommon
namespace IronRSLClient
{
class RSLClient
public class RSLClient
{
IPEndPoint[] serverEps;
IPEndPoint myEp;
int myPort;
IoScheduler scheduler;
UInt64 nextSeqNum;
int primaryServerIndex;

public RSLClient(IEnumerable<IPEndPoint> i_serverEps, IPEndPoint i_myEp)
public RSLClient(IEnumerable<IPEndPoint> i_serverEps, int i_myPort)
{
serverEps = Enumerable.ToArray(i_serverEps);
myEp = i_myEp;
myPort = i_myPort;
var myEp = new IPEndPoint(IPAddress.Any, myPort);
scheduler = new IoScheduler(myEp, true, false); // onlyClient = true, verbose = false
primaryServerIndex = 0;
Start();
Expand Down
4 changes: 2 additions & 2 deletions ironfleet/src/IronRSLCounterClient/Client.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using IronfleetCommon;
using IronfleetIoFramework;
using IronRSLClient;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -66,8 +67,7 @@ static public IEnumerable<Thread> StartThreads<T>(Params ps)

private void Run()
{
IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), ps.clientPort + (int)id);
RSLClient rslClient = new RSLClient(ps.serverEps, myEndpoint);
RSLClient rslClient = new RSLClient(ps.serverEps, ps.clientPort + (int)id);

Thread.Sleep(3000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="..\IronfleetCommon\Networking.cs" />
<Compile Include="..\IronfleetCommon\RSLClient.cs" />
<Compile Include="..\IronfleetCommon\Timer.cs" />
<Compile Include="..\Dafny\Distributed\Common\Native\IoFramework.cs" />
<PackageReference Include="IronRSLClient" Version="1.0.2" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions ironfleet/src/IronRSLKVClient/Client.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using IronfleetCommon;
using IronRSLClient;
using IronfleetIoFramework;
using KVMessages;
using System;
Expand Down Expand Up @@ -74,8 +75,7 @@ private static KVRequest GetRandomRequest(Random rng, Params ps)

private void Run()
{
IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), ps.clientPort + (int)id);
RSLClient rslClient = new RSLClient(ps.serverEps, myEndpoint);
RSLClient rslClient = new RSLClient(ps.serverEps, ps.clientPort + (int)id);

Thread.Sleep(3000);

Expand Down
6 changes: 2 additions & 4 deletions ironfleet/src/IronRSLKVClient/IronRSLKVClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="..\IronfleetCommon\Networking.cs" />
<Compile Include="..\IronfleetCommon\RSLClient.cs" />
<Compile Include="..\IronfleetCommon\Timer.cs" />
<Compile Include="..\IronRSLKVServer\KVMessages.cs" />
<Compile Include="..\Dafny\Distributed\Common\Native\IoFramework.cs" />
<PackageReference Include="IronRSLClient" Version="1.0.2" />
<Compile Include="..\IronfleetCommon\Timer.cs" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions ironfleet/src/IronSHTClient/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public string ByteArrayToString(byte[] ba)

public void Setup()
{
IPEndPoint myEndpoint = new IPEndPoint(ps.clientEp.Address, ps.clientEp.Port + (int)id);
IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Any, ps.clientPort + (int)id);
scheduler = new IoScheduler(myEndpoint, false /* only client */, false /* verbose */);

ulong myaddr = EncodeIpPort(myEndpoint);
Expand Down Expand Up @@ -424,7 +424,7 @@ public void Experiment()
ulong requestKey = 150;
int serverIdx = 0;

IPEndPoint myEndpoint = new IPEndPoint(ps.clientEp.Address, ps.clientEp.Port + ps.numSetupThreads + (int)id);
IPEndPoint myEndpoint = new IPEndPoint(IPAddress.Any, ps.clientPort + ps.numSetupThreads + (int)id);
scheduler = new IoScheduler(myEndpoint, false /* only client */, false /* verbose */);
ulong myaddr = EncodeIpPort(myEndpoint);
ulong seqNum = 0;
Expand Down
8 changes: 4 additions & 4 deletions ironfleet/src/IronSHTClient/Params.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Params
public int numSetupThreads;
public int numThreads;
public ulong experimentDuration;
public IPEndPoint clientEp;
public int clientPort;
public IPEndPoint[] serverEps;
public ulong initialSeqNum;
public double setFraction;
Expand All @@ -28,7 +28,7 @@ public Params()
serverEps = new IPEndPoint[3] { IPEndPoint.Parse("127.0.0.1:4001"),
IPEndPoint.Parse("127.0.0.1:4002"),
IPEndPoint.Parse("127.0.0.1:4003") };
clientEp = IPEndPoint.Parse("127.0.0.1:6000");
clientPort = 6000;
initialSeqNum = 0;
workload = 's';
numKeys = 1000;
Expand All @@ -52,8 +52,8 @@ private bool SetValue(string key, string value)
{
try {
switch (key) {
case "client" :
clientEp = IronfleetCommon.Networking.ResolveIPEndpoint(value);
case "clientport" :
clientPort = Convert.ToInt32(value);
return true;

case "server1" :
Expand Down
2 changes: 1 addition & 1 deletion ironfleet/src/IronfleetCommon/Networking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace IronfleetCommon
{
class Networking
public class Networking
{
public static IPEndPoint ResolveIPEndpoint(string s)
{
Expand Down

0 comments on commit d7dc895

Please sign in to comment.