-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces separate silo and client projects as a sample
* Relates to #60
- Loading branch information
Showing
6 changed files
with
135 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" /> | ||
<PackageReference Include="Microsoft.Orleans.Client" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Orleans.SyncWork.Demo.Services\Orleans.SyncWork.Demo.Services.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Hosting; | ||
using Orleans.SyncWork.Demo.Services.Grains; | ||
using Orleans.SyncWork; | ||
|
||
Console.WriteLine("Hello, World!"); | ||
|
||
IHostBuilder builder = Host.CreateDefaultBuilder(args) | ||
.UseOrleansClient(client => | ||
{ | ||
client.UseLocalhostClustering(); | ||
}) | ||
.ConfigureLogging(logging => logging.AddConsole()) | ||
.UseConsoleLifetime(); | ||
|
||
using IHost host = builder.Build(); | ||
await host.StartAsync(); | ||
|
||
IClusterClient client = host.Services.GetRequiredService<IClusterClient>(); | ||
|
||
IPasswordVerifierGrain grain = client.GetGrain<IPasswordVerifierGrain>(Guid.NewGuid()); | ||
|
||
var result = await grain.StartWorkAndPollUntilResult( | ||
new PasswordVerifierRequest() | ||
{ | ||
Password = "my super neat password that's totally secure because it's super long", | ||
PasswordHash = "$2a$11$vBzJ4Ewx28C127AG5x3kT.QCCS8ai0l4JLX3VOX3MzHRkF4/A5twy" | ||
}); | ||
|
||
Console.WriteLine($""" | ||
IsValid password: {result.IsValid} | ||
Press any key to exit... | ||
"""); | ||
|
||
Console.ReadKey(); | ||
|
||
await host.StopAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Orleans.SyncWork.Demo.Services; | ||
using Orleans.SyncWork.ExtensionMethods; | ||
|
||
Console.WriteLine("Hello, World!"); | ||
|
||
IHostBuilder builder = Host.CreateDefaultBuilder(args) | ||
.UseOrleans(silo => | ||
{ | ||
silo.UseLocalhostClustering() | ||
.ConfigureLogging(logging => logging.AddConsole()); | ||
silo.ConfigureSyncWorkAbstraction(2); | ||
}) | ||
.UseConsoleLifetime() | ||
.ConfigureServices(collection => | ||
{ | ||
collection.AddSingleton<IPasswordVerifier, PasswordVerifier>(); | ||
}); | ||
|
||
using IHost host = builder.Build(); | ||
|
||
await host.RunAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" /> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" /> | ||
<PackageReference Include="Microsoft.Orleans.Server" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Orleans.SyncWork\Orleans.SyncWork.csproj" /> | ||
<ProjectReference Include="..\..\Orleans.SyncWork.Demo.Services\Orleans.SyncWork.Demo.Services.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |