Update all references to AmbrosiaLibCS to the latest version. Delete PerformanceTestInterruptible/GeneratedSourceFiles. They have version-specific info that is not portable.

This commit is contained in:
Ryan Newton 2018-12-07 16:06:25 -08:00
Родитель cee163d7d8
Коммит 3468e56dd9
28 изменённых файлов: 15 добавлений и 2272 удалений

Просмотреть файл

@ -17,7 +17,8 @@
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="2.7.0" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives">
<Version>4.3.0</Version>

Просмотреть файл

@ -119,7 +119,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />

Просмотреть файл

@ -77,7 +77,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />

Просмотреть файл

@ -23,11 +23,13 @@ ADD API /ambrosia/InternalImmortals/PerformanceTestInterruptible/API
RUN $BUILDIT API/ServerAPI.csproj
# Run the code-generation tool:
RUN mkdir -p GeneratedSourceFiles && mkdir -p ./CodeGenDependencies/netcoreapp2.0 && \
AmbrosiaCS CodeGen -a IJob/bin/Release/netcoreapp2.0/linux-x64/IJob.dll -a API/bin/Release/netcoreapp2.0/linux-x64/ServerAPI.dll -o PTIAmbrosiaGeneratedAPI -f netcoreapp2.0 -b ./CodeGenDependencies/netcoreapp2.0
RUN rm -rf ./GeneratedSourceFiles && \
mkdir -p GeneratedSourceFiles && \
mkdir -p ./CodeGenDependencies/netcoreapp2.0 && \
AmbrosiaCS CodeGen -a IJob/bin/Release/netcoreapp2.0/linux-x64/IJob.dll -a API/bin/Release/netcoreapp2.0/linux-x64/ServerAPI.dll -o PTIAmbrosiaGeneratedAPINetCore -f netcoreapp2.0 -b ./CodeGenDependencies/netcoreapp2.0
# publish the api dll whose project we just created:
RUN $BUILDIT GeneratedSourceFiles/PTIAmbrosiaGeneratedAPI/latest/PTIAmbrosiaGeneratedAPI.csproj
RUN $BUILDIT GeneratedSourceFiles/PTIAmbrosiaGeneratedAPINetCore/latest/PTIAmbrosiaGeneratedAPINetCore.csproj
# publish the client/server executables that we'll actually run:
ADD Client /ambrosia/InternalImmortals/PerformanceTestInterruptible/Client

Просмотреть файл

@ -1,10 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace JobAPI {
[DataContractAttribute]
public struct BoxedDateTime
{
[DataMemberAttribute]
public DateTime val;
}
}

Просмотреть файл

@ -1,173 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using LocalAmbrosiaRuntime;
namespace JobAPI
{
/// <summary>
/// This class runs in the process of the object that implements the interface IJob
/// and communicates with the local Ambrosia runtime.
/// It is instantiated in ImmortalFactory.CreateServer when a bootstrapper registers a container
/// that supports the interface IJob.
/// </summary>
class IJob_Dispatcher_Implementation : Immortal.Dispatcher
{
private readonly IJob instance;
private readonly ExceptionSerializer exceptionSerializer = new ExceptionSerializer(new List<Type>());
public IJob_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string serviceName, int receivePort, int sendPort, bool setupConnections)
: base(z, myImmortalSerializer, serviceName, receivePort, sendPort, setupConnections)
{
this.instance = (IJob) z;
}
public IJob_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string localAmbrosiaRuntime, Type newInterface, Type newImmortalType, int receivePort, int sendPort)
: base(z, myImmortalSerializer, localAmbrosiaRuntime, newInterface, newImmortalType, receivePort, sendPort)
{
this.instance = (IJob) z;
}
public override async Task<bool> DispatchToMethod(int methodId, RpcTypes.RpcType rpcType, string senderOfRPC, long sequenceNumber, byte[] buffer, int cursor)
{
switch (methodId)
{
case 0:
// Entry point
this.EntryPoint();
break;
case 1:
// JobContinueAsync
{
// deserialize arguments
// arg0: System.Int32
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = Ambrosia.BinarySerializer.Deserialize<System.Int32>(p_0_ValueBuffer);
// arg1: System.Int64
var p_1_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_1_ValueLength);
var p_1_ValueBuffer = new byte[p_1_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_1_ValueBuffer, 0, p_1_ValueLength);
cursor += p_1_ValueLength;
var p_1 = Ambrosia.BinarySerializer.Deserialize<System.Int64>(p_1_ValueBuffer);
// arg2: JobAPI.BoxedDateTime
var p_2_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_2_ValueLength);
var p_2_ValueBuffer = new byte[p_2_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_2_ValueBuffer, 0, p_2_ValueLength);
cursor += p_2_ValueLength;
var p_2 = Ambrosia.BinarySerializer.Deserialize<JobAPI.BoxedDateTime>(p_2_ValueBuffer);
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg3Size = 0;
byte[] arg3Bytes = null;
try
{
await this.instance.JobContinueAsync(p_0,p_1,p_2);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg3Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg3Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 2:
// MAsync
{
// deserialize arguments
// arg0: System.Byte[]
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = p_0_ValueBuffer;
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.MAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 3:
// PrintBytesReceivedAsync
{
// deserialize arguments
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg0Size = 0;
byte[] arg0Bytes = null;
try
{
await this.instance.PrintBytesReceivedAsync();
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg0Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg0Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
}
return true;
}
}
}

Просмотреть файл

@ -1,155 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using LocalAmbrosiaRuntime;
namespace Server
{
/// <summary>
/// This class runs in the process of the object that implements the interface IServer
/// and communicates with the local Ambrosia runtime.
/// It is instantiated in ImmortalFactory.CreateServer when a bootstrapper registers a container
/// that supports the interface IServer.
/// </summary>
class IServer_Dispatcher_Implementation : Immortal.Dispatcher
{
private readonly IServer instance;
private readonly ExceptionSerializer exceptionSerializer = new ExceptionSerializer(new List<Type>());
public IServer_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string serviceName, int receivePort, int sendPort, bool setupConnections)
: base(z, myImmortalSerializer, serviceName, receivePort, sendPort, setupConnections)
{
this.instance = (IServer) z;
}
public IServer_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string localAmbrosiaRuntime, Type newInterface, Type newImmortalType, int receivePort, int sendPort)
: base(z, myImmortalSerializer, localAmbrosiaRuntime, newInterface, newImmortalType, receivePort, sendPort)
{
this.instance = (IServer) z;
}
public override async Task<bool> DispatchToMethod(int methodId, RpcTypes.RpcType rpcType, string senderOfRPC, long sequenceNumber, byte[] buffer, int cursor)
{
switch (methodId)
{
case 0:
// Entry point
this.EntryPoint();
break;
case 1:
// MAsync
{
// deserialize arguments
// arg0: System.Byte[]
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = p_0_ValueBuffer;
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.MAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 2:
// AmIHealthyAsync
{
// deserialize arguments
// arg0: System.DateTime
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = Ambrosia.BinarySerializer.Deserialize<System.DateTime>(p_0_ValueBuffer);
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.AmIHealthyAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 3:
// PrintBytesReceivedAsync
{
// deserialize arguments
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg0Size = 0;
byte[] arg0Bytes = null;
try
{
await this.instance.PrintBytesReceivedAsync();
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg0Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg0Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
}
return true;
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using System.Xml;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using Server;
using JobAPI;
namespace Ambrosia
{
/// <summary>
/// This class is the serializer that supports serialization of a Immortal and has the generated classes as a known types
/// </summary>]
public class ImmortalSerializer : ImmortalSerializerBase
{
public ImmortalSerializer()
{
base.KnownTypes = new SerializableType[]
{
new SerializableType(typeof(IServerProxy_Implementation)),
new SerializableType(typeof(IJobProxy_Implementation)),
new SerializableType(this.GetType())
};
}
public override long SerializeSize(Immortal c)
{
var serializer = new DataContractSerializer(c.GetType(), this.KnownTypes.Select(kt => kt.Type).ToArray());
long retVal = -1;
using (var countStream = new CountStream())
{
using (var writer = XmlDictionaryWriter.CreateBinaryWriter(countStream))
{
serializer.WriteObject(writer, c);
}
retVal = countStream.Length;
}
return retVal;
}
public override void Serialize(Immortal c, Stream writeToStream)
{
// nned to create
var serializer = new DataContractSerializer(c.GetType(), this.KnownTypes.Select(kt => kt.Type).ToArray());
using (var writer = XmlDictionaryWriter.CreateBinaryWriter(writeToStream))
{
serializer.WriteObject(writer, c);
}
}
public override Immortal Deserialize(Type runtimeType, Stream stream)
{
var serializer = new DataContractSerializer(runtimeType, this.KnownTypes.Select(kt => kt.Type).ToArray());
using (var reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
{
return (Immortal)serializer.ReadObject(reader);
}
}
}
public interface Empty : IEmpty
{
}
}

Просмотреть файл

@ -1,128 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="AmbrosiaLibCS">
<HintPath>../../../CodeGenDependencies/net46/AmbrosiaLibCS.dll</HintPath>
</Reference>
<Reference Include="Aqua">
<HintPath>../../../CodeGenDependencies/net46/Aqua.dll</HintPath>
</Reference>
<Reference Include="CRA.ClientLibrary">
<HintPath>../../../CodeGenDependencies/net46/CRA.ClientLibrary.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.KeyVault.Core">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.Azure.KeyVault.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.CodeAnalysis.CSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Scripting">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.CodeAnalysis.CSharp.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Scripting">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.CodeAnalysis.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Threading">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.VisualStudio.Threading.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Validation">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.VisualStudio.Validation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>../../../CodeGenDependencies/net46/Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Mono.Options.Core">
<HintPath>../../../CodeGenDependencies/net46/Mono.Options.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>../../../CodeGenDependencies/net46/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Remote.Linq">
<HintPath>../../../CodeGenDependencies/net46/Remote.Linq.dll</HintPath>
</Reference>
<Reference Include="System.AppContext">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.AppContext/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.AppContext.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable">
<HintPath>../../../CodeGenDependencies/net46/System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Console">
<HintPath>../../../CodeGenDependencies/net46/System.Console.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.FileVersionInfo">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Diagnostics.FileVersionInfo/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Diagnostics.FileVersionInfo.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.StackTrace">
<HintPath>../../../CodeGenDependencies/net46/System.Diagnostics.StackTrace.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression">
<HintPath>../../../CodeGenDependencies/net46/System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem">
<HintPath>../../../CodeGenDependencies/net46/System.IO.FileSystem.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives">
<HintPath>../../../CodeGenDependencies/net46/System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata">
<HintPath>../../../CodeGenDependencies/net46/System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization.Primitives">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization.Primitives/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.Serialization.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security.Cryptography.Algorithms/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security.Cryptography.Encoding/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives">
<HintPath>../../../CodeGenDependencies/net46/System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security.Cryptography.X509Certificates/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encoding.CodePages">
<HintPath>../../../CodeGenDependencies/net46/System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Dataflow">
<HintPath>../../../CodeGenDependencies/net46/System.Threading.Tasks.Dataflow.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Thread">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Threading.Thread/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Threading.Thread.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ValueTuple/v4.0_4.0.0.0__cc7b13ffcd2ddd51/System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.ReaderWriter">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.ReaderWriter/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Xml.ReaderWriter.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XmlDocument">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.XmlDocument/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Xml.XmlDocument.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XPath">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.XPath/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Xml.XPath.dll</HintPath>
</Reference>
<Reference Include="System.Xml.XPath.XDocument">
<HintPath>../../../../../../../WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.XPath.XDocument/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Xml.XPath.XDocument.dll</HintPath>
</Reference>
<Reference Include="Ambrosia">
<HintPath>../../../CodeGenDependencies/net46/Ambrosia.exe</HintPath>
</Reference>
<Reference Include="CRA.Worker">
<HintPath>../../../CodeGenDependencies/net46/CRA.Worker.exe</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageReference Update="Microsoft.NETCore.App=" Version="2.0.0=" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,34 +0,0 @@
using System;
using Ambrosia;
using System.Threading.Tasks;
using static Ambrosia.StreamCommunicator;
namespace JobAPI
{
/// <summary>
// Generated from IJob by the proxy generation.
// This is the API that any immortal implementing the interface must be a subtype of.
/// </summary>
public interface IJob
{
Task JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
Task MAsync(System.Byte[] p_0);
Task PrintBytesReceivedAsync();
}
/// <summary>
// Generated from IJob by the proxy generation.
// This is the API that is used to call a immortal that implements
/// </summary>
[Ambrosia.InstanceProxy(typeof(IJob))]
public interface IJobProxy
{
Task JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
void JobContinueFork(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
Task MAsync(System.Byte[] p_0);
void MFork(System.Byte[] p_0);
Task PrintBytesReceivedAsync();
void PrintBytesReceivedFork();
}
}

Просмотреть файл

@ -1,33 +0,0 @@
using System;
using Ambrosia;
using System.Threading.Tasks;
using static Ambrosia.StreamCommunicator;
namespace Server
{
/// <summary>
// Generated from IServer by the proxy generation.
// This is the API that any immortal implementing the interface must be a subtype of.
/// </summary>
public interface IServer
{
Task MAsync(System.Byte[] p_0);
Task AmIHealthyAsync(System.DateTime p_0);
Task PrintBytesReceivedAsync();
}
/// <summary>
// Generated from IServer by the proxy generation.
// This is the API that is used to call a immortal that implements
/// </summary>
[Ambrosia.InstanceProxy(typeof(IServer))]
public interface IServerProxy
{
Task MAsync(System.Byte[] p_0);
void MFork(System.Byte[] p_0);
void AmIHealthyFork(System.DateTime p_0);
Task PrintBytesReceivedAsync();
void PrintBytesReceivedFork();
}
}

Просмотреть файл

@ -1,327 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
namespace JobAPI
{
/// <summary>
/// This class is the proxy that runs in the client's process and communicates with the local Ambrosia runtime.
/// It runs within the client's process, so it is generated in the language that the client is using.
/// It is returned from ImmortalFactory.CreateClient when a client requests a container that supports the interface IJobProxy.
/// </summary>
[System.Runtime.Serialization.DataContract]
public class IJobProxy_Implementation : Immortal.InstanceProxy, IJobProxy
{
public IJobProxy_Implementation(string remoteAmbrosiaRuntime, bool attachNeeded)
: base(remoteAmbrosiaRuntime, attachNeeded)
{
}
async Task
IJobProxy.JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
await JobContinueAsync(p_0,p_1,p_2);
}
async Task
JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.Int32>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
int arg1Size = 0;
byte[] arg1Bytes = null;
// Argument 1
arg1Bytes = Ambrosia.BinarySerializer.Serialize<System.Int64>(p_1);
arg1Size = IntSize(arg1Bytes.Length) + arg1Bytes.Length;
totalArgSize += arg1Size;
int arg2Size = 0;
byte[] arg2Bytes = null;
// Argument 2
arg2Bytes = Ambrosia.BinarySerializer.Serialize<JobAPI.BoxedDateTime>(p_2);
arg2Size = IntSize(arg2Bytes.Length) + arg2Bytes.Length;
totalArgSize += arg2Size;
var wp = this.StartRPC<object>(methodIdentifier: 1 /* method identifier for JobContinue */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
// Serialize arg1
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg1Bytes.Length);
Buffer.BlockCopy(arg1Bytes, 0, wp.PageBytes, wp.curLength, arg1Bytes.Length);
wp.curLength += arg1Bytes.Length;
// Serialize arg2
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg2Bytes.Length);
Buffer.BlockCopy(arg2Bytes, 0, wp.PageBytes, wp.curLength, arg2Bytes.Length);
wp.curLength += arg2Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.JobContinueFork(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.Int32>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
// Argument 1
int arg1Size = 0;
byte[] arg1Bytes = null;
arg1Bytes = Ambrosia.BinarySerializer.Serialize<System.Int64>(p_1);
arg1Size = IntSize(arg1Bytes.Length) + arg1Bytes.Length;
totalArgSize += arg1Size;
// Argument 2
int arg2Size = 0;
byte[] arg2Bytes = null;
arg2Bytes = Ambrosia.BinarySerializer.Serialize<JobAPI.BoxedDateTime>(p_2);
arg2Size = IntSize(arg2Bytes.Length) + arg2Bytes.Length;
totalArgSize += arg2Size;
var wp = this.StartRPC<object>(1 /* method identifier for JobContinue */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
// Serialize arg1
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg1Bytes.Length);
Buffer.BlockCopy(arg1Bytes, 0, wp.PageBytes, wp.curLength, arg1Bytes.Length);
wp.curLength += arg1Bytes.Length;
// Serialize arg2
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg2Bytes.Length);
Buffer.BlockCopy(arg2Bytes, 0, wp.PageBytes, wp.curLength, arg2Bytes.Length);
wp.curLength += arg2Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
JobContinue_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method JobContinue returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IJobProxy.MAsync(System.Byte[] p_0)
{
await MAsync(p_0);
}
async Task
MAsync(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(methodIdentifier: 2 /* method identifier for M */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.MFork(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(2 /* method identifier for M */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
M_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method M returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IJobProxy.PrintBytesReceivedAsync()
{
await PrintBytesReceivedAsync();
}
async Task
PrintBytesReceivedAsync()
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(methodIdentifier: 3 /* method identifier for PrintBytesReceived */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.PrintBytesReceivedFork()
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(3 /* method identifier for PrintBytesReceived */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
this.ReleaseBufferAndSend();
return;
}
private object
PrintBytesReceived_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method PrintBytesReceived returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
}
}

Просмотреть файл

@ -1,219 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
namespace Server
{
/// <summary>
/// This class is the proxy that runs in the client's process and communicates with the local Ambrosia runtime.
/// It runs within the client's process, so it is generated in the language that the client is using.
/// It is returned from ImmortalFactory.CreateClient when a client requests a container that supports the interface IServerProxy.
/// </summary>
[System.Runtime.Serialization.DataContract]
public class IServerProxy_Implementation : Immortal.InstanceProxy, IServerProxy
{
public IServerProxy_Implementation(string remoteAmbrosiaRuntime, bool attachNeeded)
: base(remoteAmbrosiaRuntime, attachNeeded)
{
}
async Task
IServerProxy.MAsync(System.Byte[] p_0)
{
await MAsync(p_0);
}
async Task
MAsync(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(methodIdentifier: 1 /* method identifier for M */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IServerProxy.MFork(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(1 /* method identifier for M */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
M_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method M returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
void IServerProxy.AmIHealthyFork(System.DateTime p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.DateTime>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(2 /* method identifier for AmIHealthy */, totalArgSize, out rpcTask, RpcTypes.RpcType.Impulse);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
AmIHealthy_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method AmIHealthy returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IServerProxy.PrintBytesReceivedAsync()
{
await PrintBytesReceivedAsync();
}
async Task
PrintBytesReceivedAsync()
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(methodIdentifier: 3 /* method identifier for PrintBytesReceived */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IServerProxy.PrintBytesReceivedFork()
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(3 /* method identifier for PrintBytesReceived */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
this.ReleaseBufferAndSend();
return;
}
private object
PrintBytesReceived_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method PrintBytesReceived returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
}
}

Просмотреть файл

@ -1,10 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace JobAPI {
[DataContractAttribute]
public struct BoxedDateTime
{
[DataMemberAttribute]
public DateTime val;
}
}

Просмотреть файл

@ -1,173 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using LocalAmbrosiaRuntime;
namespace JobAPI
{
/// <summary>
/// This class runs in the process of the object that implements the interface IJob
/// and communicates with the local Ambrosia runtime.
/// It is instantiated in ImmortalFactory.CreateServer when a bootstrapper registers a container
/// that supports the interface IJob.
/// </summary>
class IJob_Dispatcher_Implementation : Immortal.Dispatcher
{
private readonly IJob instance;
private readonly ExceptionSerializer exceptionSerializer = new ExceptionSerializer(new List<Type>());
public IJob_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string serviceName, int receivePort, int sendPort, bool setupConnections)
: base(z, myImmortalSerializer, serviceName, receivePort, sendPort, setupConnections)
{
this.instance = (IJob) z;
}
public IJob_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string localAmbrosiaRuntime, Type newInterface, Type newImmortalType, int receivePort, int sendPort)
: base(z, myImmortalSerializer, localAmbrosiaRuntime, newInterface, newImmortalType, receivePort, sendPort)
{
this.instance = (IJob) z;
}
public override async Task<bool> DispatchToMethod(int methodId, RpcTypes.RpcType rpcType, string senderOfRPC, long sequenceNumber, byte[] buffer, int cursor)
{
switch (methodId)
{
case 0:
// Entry point
this.EntryPoint();
break;
case 1:
// JobContinueAsync
{
// deserialize arguments
// arg0: System.Int32
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = Ambrosia.BinarySerializer.Deserialize<System.Int32>(p_0_ValueBuffer);
// arg1: System.Int64
var p_1_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_1_ValueLength);
var p_1_ValueBuffer = new byte[p_1_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_1_ValueBuffer, 0, p_1_ValueLength);
cursor += p_1_ValueLength;
var p_1 = Ambrosia.BinarySerializer.Deserialize<System.Int64>(p_1_ValueBuffer);
// arg2: JobAPI.BoxedDateTime
var p_2_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_2_ValueLength);
var p_2_ValueBuffer = new byte[p_2_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_2_ValueBuffer, 0, p_2_ValueLength);
cursor += p_2_ValueLength;
var p_2 = Ambrosia.BinarySerializer.Deserialize<JobAPI.BoxedDateTime>(p_2_ValueBuffer);
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg3Size = 0;
byte[] arg3Bytes = null;
try
{
await this.instance.JobContinueAsync(p_0,p_1,p_2);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg3Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg3Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 2:
// MAsync
{
// deserialize arguments
// arg0: System.Byte[]
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = p_0_ValueBuffer;
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.MAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 3:
// PrintBytesReceivedAsync
{
// deserialize arguments
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg0Size = 0;
byte[] arg0Bytes = null;
try
{
await this.instance.PrintBytesReceivedAsync();
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg0Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg0Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
}
return true;
}
}
}

Просмотреть файл

@ -1,155 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using LocalAmbrosiaRuntime;
namespace Server
{
/// <summary>
/// This class runs in the process of the object that implements the interface IServer
/// and communicates with the local Ambrosia runtime.
/// It is instantiated in ImmortalFactory.CreateServer when a bootstrapper registers a container
/// that supports the interface IServer.
/// </summary>
class IServer_Dispatcher_Implementation : Immortal.Dispatcher
{
private readonly IServer instance;
private readonly ExceptionSerializer exceptionSerializer = new ExceptionSerializer(new List<Type>());
public IServer_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string serviceName, int receivePort, int sendPort, bool setupConnections)
: base(z, myImmortalSerializer, serviceName, receivePort, sendPort, setupConnections)
{
this.instance = (IServer) z;
}
public IServer_Dispatcher_Implementation(Immortal z, ImmortalSerializerBase myImmortalSerializer, string localAmbrosiaRuntime, Type newInterface, Type newImmortalType, int receivePort, int sendPort)
: base(z, myImmortalSerializer, localAmbrosiaRuntime, newInterface, newImmortalType, receivePort, sendPort)
{
this.instance = (IServer) z;
}
public override async Task<bool> DispatchToMethod(int methodId, RpcTypes.RpcType rpcType, string senderOfRPC, long sequenceNumber, byte[] buffer, int cursor)
{
switch (methodId)
{
case 0:
// Entry point
this.EntryPoint();
break;
case 1:
// MAsync
{
// deserialize arguments
// arg0: System.Byte[]
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = p_0_ValueBuffer;
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.MAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 2:
// AmIHealthyAsync
{
// deserialize arguments
// arg0: System.DateTime
var p_0_ValueLength = buffer.ReadBufferedInt(cursor);
cursor += IntSize(p_0_ValueLength);
var p_0_ValueBuffer = new byte[p_0_ValueLength];
Buffer.BlockCopy(buffer, cursor, p_0_ValueBuffer, 0, p_0_ValueLength);
cursor += p_0_ValueLength;
var p_0 = Ambrosia.BinarySerializer.Deserialize<System.DateTime>(p_0_ValueBuffer);
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg1Size = 0;
byte[] arg1Bytes = null;
try
{
await this.instance.AmIHealthyAsync(p_0);
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg1Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg1Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
case 3:
// PrintBytesReceivedAsync
{
// deserialize arguments
// call the method
byte[] argExBytes = null;
int argExSize = 0;
Exception currEx = null;
int arg0Size = 0;
byte[] arg0Bytes = null;
try
{
await this.instance.PrintBytesReceivedAsync();
}
catch (Exception ex)
{
currEx = ex;
}
if (!rpcType.IsFireAndForget())
{
// serialize result and send it back (there isn't one)
arg0Size = 0;
var wp = this.StartRPC_ReturnValue(senderOfRPC, sequenceNumber, currEx == null ? arg0Size : argExSize, currEx == null ? ReturnValueTypes.EmptyReturnValue : ReturnValueTypes.Exception);
this.ReleaseBufferAndSend();
}
}
break;
}
return true;
}
}
}

Просмотреть файл

@ -1,72 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using System.Xml;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
using Server;
using JobAPI;
namespace Ambrosia
{
/// <summary>
/// This class is the serializer that supports serialization of a Immortal and has the generated classes as a known types
/// </summary>]
public class ImmortalSerializer : ImmortalSerializerBase
{
public ImmortalSerializer()
{
base.KnownTypes = new SerializableType[]
{
new SerializableType(typeof(IServerProxy_Implementation)),
new SerializableType(typeof(IJobProxy_Implementation)),
new SerializableType(this.GetType())
};
}
public override long SerializeSize(Immortal c)
{
var serializer = new DataContractSerializer(c.GetType(), this.KnownTypes.Select(kt => kt.Type).ToArray());
long retVal = -1;
using (var countStream = new CountStream())
{
using (var writer = XmlDictionaryWriter.CreateBinaryWriter(countStream))
{
serializer.WriteObject(writer, c);
}
retVal = countStream.Length;
}
return retVal;
}
public override void Serialize(Immortal c, Stream writeToStream)
{
// nned to create
var serializer = new DataContractSerializer(c.GetType(), this.KnownTypes.Select(kt => kt.Type).ToArray());
using (var writer = XmlDictionaryWriter.CreateBinaryWriter(writeToStream))
{
serializer.WriteObject(writer, c);
}
}
public override Immortal Deserialize(Type runtimeType, Stream stream)
{
var serializer = new DataContractSerializer(runtimeType, this.KnownTypes.Select(kt => kt.Type).ToArray());
using (var reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
{
return (Immortal)serializer.ReadObject(reader);
}
}
}
public interface Empty : IEmpty
{
}
}

Просмотреть файл

@ -1,86 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ambrosia">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Ambrosia.dll</HintPath>
</Reference>
<Reference Include="AmbrosiaLibCS">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/AmbrosiaLibCS.dll</HintPath>
</Reference>
<Reference Include="Aqua">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Aqua.dll</HintPath>
</Reference>
<Reference Include="CRA.ClientLibrary">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/CRA.ClientLibrary.dll</HintPath>
</Reference>
<Reference Include="CRA.Worker">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/CRA.Worker.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.CodeAnalysis.CSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Scripting">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.CodeAnalysis.CSharp.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Scripting">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.CodeAnalysis.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Threading">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.VisualStudio.Threading.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Validation">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.VisualStudio.Validation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Mono.Options.Core">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Mono.Options.Core.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Remote.Linq">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/Remote.Linq.dll</HintPath>
</Reference>
<Reference Include="System.CodeDom">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.CodeDom.dll</HintPath>
</Reference>
<Reference Include="System.Configuration.ConfigurationManager">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Memory">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security.AccessControl">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Security.AccessControl.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.ProtectedData">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Security.Cryptography.ProtectedData.dll</HintPath>
</Reference>
<Reference Include="System.Security.Permissions">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Security.Permissions.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Dataflow">
<HintPath>../../../CodeGenDependencies/netcoreapp2.0/System.Threading.Tasks.Dataflow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<PackageReference Update="Microsoft.NETCore.App=" Version="2.0.0=" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,34 +0,0 @@
using System;
using Ambrosia;
using System.Threading.Tasks;
using static Ambrosia.StreamCommunicator;
namespace JobAPI
{
/// <summary>
// Generated from IJob by the proxy generation.
// This is the API that any immortal implementing the interface must be a subtype of.
/// </summary>
public interface IJob
{
Task JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
Task MAsync(System.Byte[] p_0);
Task PrintBytesReceivedAsync();
}
/// <summary>
// Generated from IJob by the proxy generation.
// This is the API that is used to call a immortal that implements
/// </summary>
[Ambrosia.InstanceProxy(typeof(IJob))]
public interface IJobProxy
{
Task JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
void JobContinueFork(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2);
Task MAsync(System.Byte[] p_0);
void MFork(System.Byte[] p_0);
Task PrintBytesReceivedAsync();
void PrintBytesReceivedFork();
}
}

Просмотреть файл

@ -1,33 +0,0 @@
using System;
using Ambrosia;
using System.Threading.Tasks;
using static Ambrosia.StreamCommunicator;
namespace Server
{
/// <summary>
// Generated from IServer by the proxy generation.
// This is the API that any immortal implementing the interface must be a subtype of.
/// </summary>
public interface IServer
{
Task MAsync(System.Byte[] p_0);
Task AmIHealthyAsync(System.DateTime p_0);
Task PrintBytesReceivedAsync();
}
/// <summary>
// Generated from IServer by the proxy generation.
// This is the API that is used to call a immortal that implements
/// </summary>
[Ambrosia.InstanceProxy(typeof(IServer))]
public interface IServerProxy
{
Task MAsync(System.Byte[] p_0);
void MFork(System.Byte[] p_0);
void AmIHealthyFork(System.DateTime p_0);
Task PrintBytesReceivedAsync();
void PrintBytesReceivedFork();
}
}

Просмотреть файл

@ -1,327 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
namespace JobAPI
{
/// <summary>
/// This class is the proxy that runs in the client's process and communicates with the local Ambrosia runtime.
/// It runs within the client's process, so it is generated in the language that the client is using.
/// It is returned from ImmortalFactory.CreateClient when a client requests a container that supports the interface IJobProxy.
/// </summary>
[System.Runtime.Serialization.DataContract]
public class IJobProxy_Implementation : Immortal.InstanceProxy, IJobProxy
{
public IJobProxy_Implementation(string remoteAmbrosiaRuntime, bool attachNeeded)
: base(remoteAmbrosiaRuntime, attachNeeded)
{
}
async Task
IJobProxy.JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
await JobContinueAsync(p_0,p_1,p_2);
}
async Task
JobContinueAsync(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.Int32>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
int arg1Size = 0;
byte[] arg1Bytes = null;
// Argument 1
arg1Bytes = Ambrosia.BinarySerializer.Serialize<System.Int64>(p_1);
arg1Size = IntSize(arg1Bytes.Length) + arg1Bytes.Length;
totalArgSize += arg1Size;
int arg2Size = 0;
byte[] arg2Bytes = null;
// Argument 2
arg2Bytes = Ambrosia.BinarySerializer.Serialize<JobAPI.BoxedDateTime>(p_2);
arg2Size = IntSize(arg2Bytes.Length) + arg2Bytes.Length;
totalArgSize += arg2Size;
var wp = this.StartRPC<object>(methodIdentifier: 1 /* method identifier for JobContinue */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
// Serialize arg1
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg1Bytes.Length);
Buffer.BlockCopy(arg1Bytes, 0, wp.PageBytes, wp.curLength, arg1Bytes.Length);
wp.curLength += arg1Bytes.Length;
// Serialize arg2
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg2Bytes.Length);
Buffer.BlockCopy(arg2Bytes, 0, wp.PageBytes, wp.curLength, arg2Bytes.Length);
wp.curLength += arg2Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.JobContinueFork(System.Int32 p_0,System.Int64 p_1,JobAPI.BoxedDateTime p_2)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.Int32>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
// Argument 1
int arg1Size = 0;
byte[] arg1Bytes = null;
arg1Bytes = Ambrosia.BinarySerializer.Serialize<System.Int64>(p_1);
arg1Size = IntSize(arg1Bytes.Length) + arg1Bytes.Length;
totalArgSize += arg1Size;
// Argument 2
int arg2Size = 0;
byte[] arg2Bytes = null;
arg2Bytes = Ambrosia.BinarySerializer.Serialize<JobAPI.BoxedDateTime>(p_2);
arg2Size = IntSize(arg2Bytes.Length) + arg2Bytes.Length;
totalArgSize += arg2Size;
var wp = this.StartRPC<object>(1 /* method identifier for JobContinue */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
// Serialize arg1
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg1Bytes.Length);
Buffer.BlockCopy(arg1Bytes, 0, wp.PageBytes, wp.curLength, arg1Bytes.Length);
wp.curLength += arg1Bytes.Length;
// Serialize arg2
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg2Bytes.Length);
Buffer.BlockCopy(arg2Bytes, 0, wp.PageBytes, wp.curLength, arg2Bytes.Length);
wp.curLength += arg2Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
JobContinue_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method JobContinue returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IJobProxy.MAsync(System.Byte[] p_0)
{
await MAsync(p_0);
}
async Task
MAsync(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(methodIdentifier: 2 /* method identifier for M */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.MFork(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(2 /* method identifier for M */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
M_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method M returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IJobProxy.PrintBytesReceivedAsync()
{
await PrintBytesReceivedAsync();
}
async Task
PrintBytesReceivedAsync()
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(methodIdentifier: 3 /* method identifier for PrintBytesReceived */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IJobProxy.PrintBytesReceivedFork()
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(3 /* method identifier for PrintBytesReceived */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
this.ReleaseBufferAndSend();
return;
}
private object
PrintBytesReceived_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method PrintBytesReceived returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
}
}

Просмотреть файл

@ -1,219 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Ambrosia;
using static Ambrosia.StreamCommunicator;
namespace Server
{
/// <summary>
/// This class is the proxy that runs in the client's process and communicates with the local Ambrosia runtime.
/// It runs within the client's process, so it is generated in the language that the client is using.
/// It is returned from ImmortalFactory.CreateClient when a client requests a container that supports the interface IServerProxy.
/// </summary>
[System.Runtime.Serialization.DataContract]
public class IServerProxy_Implementation : Immortal.InstanceProxy, IServerProxy
{
public IServerProxy_Implementation(string remoteAmbrosiaRuntime, bool attachNeeded)
: base(remoteAmbrosiaRuntime, attachNeeded)
{
}
async Task
IServerProxy.MAsync(System.Byte[] p_0)
{
await MAsync(p_0);
}
async Task
MAsync(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
int arg0Size = 0;
byte[] arg0Bytes = null;
// Argument 0
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(methodIdentifier: 1 /* method identifier for M */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IServerProxy.MFork(System.Byte[] p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = p_0;
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(1 /* method identifier for M */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
M_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method M returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
void IServerProxy.AmIHealthyFork(System.DateTime p_0)
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
// Argument 0
int arg0Size = 0;
byte[] arg0Bytes = null;
arg0Bytes = Ambrosia.BinarySerializer.Serialize<System.DateTime>(p_0);
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
totalArgSize += arg0Size;
var wp = this.StartRPC<object>(2 /* method identifier for AmIHealthy */, totalArgSize, out rpcTask, RpcTypes.RpcType.Impulse);
// Serialize arguments
// Serialize arg0
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
wp.curLength += arg0Bytes.Length;
this.ReleaseBufferAndSend();
return;
}
private object
AmIHealthy_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method AmIHealthy returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
async Task
IServerProxy.PrintBytesReceivedAsync()
{
await PrintBytesReceivedAsync();
}
async Task
PrintBytesReceivedAsync()
{
SerializableTaskCompletionSource rpcTask;
// Make call, wait for reply
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(methodIdentifier: 3 /* method identifier for PrintBytesReceived */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
// Serialize arguments
ReleaseBufferAndSend();
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
var currentResult = await taskToWaitFor;
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
if (isSaved)
{
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
currentResult = await taskToWaitFor;
}
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
return;
}
void IServerProxy.PrintBytesReceivedFork()
{
SerializableTaskCompletionSource rpcTask;
// Compute size of serialized arguments
var totalArgSize = 0;
var wp = this.StartRPC<object>(3 /* method identifier for PrintBytesReceived */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
// Serialize arguments
this.ReleaseBufferAndSend();
return;
}
private object
PrintBytesReceived_ReturnValue(byte[] buffer, int cursor)
{
// buffer will be an empty byte array since the method PrintBytesReceived returns void
// so nothing to read, just getting called is the signal to return to the client
return this;
}
}
}

Просмотреть файл

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.28.7" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />

Просмотреть файл

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />

Просмотреть файл

@ -6,7 +6,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.30.1" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />

Просмотреть файл

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.28.7" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AmbrosiaLibCS" Version="2018.11.28.7" />
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.06.3" />
</ItemGroup>
</Project>