Skip to content

Re-organize the project layout and refactor request processing code #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions azure-functions-powershell-worker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8C758288-3909-4CE1-972D-1BE966628D6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker", "src\Azure.Functions.PowerShell.Worker\Azure.Functions.PowerShell.Worker.csproj", "{939262BA-4823-405E-81CD-436C0B77D524}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker", "src\Azure.Functions.PowerShell.Worker.csproj", "{939262BA-4823-405E-81CD-436C0B77D524}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{12092936-4F2A-4B40-9AF2-56C840D44FEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker.Test", "test\Azure.Functions.PowerShell.Worker.Test\Azure.Functions.PowerShell.Worker.Test.csproj", "{535C8DA3-479D-42BF-B1AF-5B03ECAF67A4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Functions.PowerShell.Worker.Test", "test\Azure.Functions.PowerShell.Worker.Test.csproj", "{535C8DA3-479D-42BF-B1AF-5B03ECAF67A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("Azure.Functions.PowerShell.Worker.Test")]

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0-rc.1" />
Expand All @@ -27,7 +28,8 @@
<None Include="worker.config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Azure.Functions.PowerShell.Worker.Module\**">
<None Include="Modules\**">
<Link>Modules\%(RecursiveDir)\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

114 changes: 0 additions & 114 deletions src/Azure.Functions.PowerShell.Worker/Worker.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

namespace Microsoft.Azure.Functions.PowerShellWorker.Messaging
{
internal class FunctionMessagingClient : IDisposable
internal class MessagingStream : IDisposable
{
SemaphoreSlim _writeStreamHandle = new SemaphoreSlim(1, 1);
AsyncDuplexStreamingCall<StreamingMessage, StreamingMessage> _call;
public bool isDisposed;
private SemaphoreSlim _writeStreamHandle = new SemaphoreSlim(1, 1);
private AsyncDuplexStreamingCall<StreamingMessage, StreamingMessage> _call;
private bool isDisposed;

public FunctionMessagingClient(string host, int port)
public MessagingStream(string host, int port)
{
Channel channel = new Channel(host, port, ChannelCredentials.Insecure);
_call = new FunctionRpc.FunctionRpcClient(channel).EventStream();
Expand Down Expand Up @@ -56,4 +56,4 @@ public async Task WriteAsync(StreamingMessage message)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Utility
{
internal class RpcLogger : ILogger
{
FunctionMessagingClient _client;
string _invocationId = "";
string _requestId = "";
private MessagingStream _msgStream;
private string _invocationId = "";
private string _requestId = "";

public RpcLogger(FunctionMessagingClient client)
public RpcLogger(MessagingStream msgStream)
{
_client = client;
_msgStream = msgStream;
}

public IDisposable BeginScope<TState>(TState state) =>
Expand Down Expand Up @@ -51,7 +51,7 @@ public bool IsEnabled(LogLevel logLevel) =>

public async void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if (_client != null)
if (_msgStream != null)
{
var logMessage = new StreamingMessage
{
Expand All @@ -65,7 +65,7 @@ public async void Log<TState>(LogLevel logLevel, EventId eventId, TState state,
}
};

await _client.WriteAsync(logMessage);
await _msgStream.WriteAsync(logMessage);
}
}

Expand Down
Loading