Skip to content

Commit c62a70e

Browse files
Ledjon BehluliLedjon Behluli
authored andcommitted
.
1 parent 99797bc commit c62a70e

File tree

11 files changed

+23
-18
lines changed

11 files changed

+23
-18
lines changed

samples/02_HelloWorld/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
Console.WriteLine($"THREAD 1: Searching for matching tuple with template: {template}");
3434

35-
var helloWorldTuple = await agent.Peek(template);
35+
var helloWorldTuple = await agent.PeekAsync(template);
3636
if (!helloWorldTuple.IsEmpty)
3737
{
3838
Console.WriteLine($"THREAD 1: Found this tuple: {helloWorldTuple}");
@@ -50,7 +50,7 @@
5050

5151
while (true)
5252
{
53-
var helloTuple = await agent.Peek(template);
53+
var helloTuple = await agent.PeekAsync(template);
5454
if (!helloTuple.IsEmpty)
5555
{
5656
Console.WriteLine($"THREAD 2: Found this tuple: {helloTuple}");

samples/03_Concurrent/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ await Task.WhenAll(CreateTasks(100, async index =>
3333

3434
await Task.WhenAll(CreateTasks(100, async index =>
3535
{
36-
SpaceTuple tuple = await agent.Peek(new(EXCHANGE_KEY, index));
36+
SpaceTuple tuple = await agent.PeekAsync(new(EXCHANGE_KEY, index));
3737
Console.WriteLine($"READER {index}: {tuple}");
3838
}));
3939

samples/04_DelayedExec/Evaluator/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ await agent.EvaluateAsync(async () =>
5151
await Task.Delay(500);
5252
}
5353

54-
Console.WriteLine($"WORKER: Result from evaluation: {await agent.Peek(new(EXCHANGE_KEY, typeof(double)))}");
54+
Console.WriteLine($"WORKER: Result from evaluation: {await agent.PeekAsync(new(EXCHANGE_KEY, typeof(double)))}");
5555

5656
Console.WriteLine("\nPress any key to terminate...");
5757
Console.ReadKey();

samples/04_DelayedExec/Peeker/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ await agent.PeekAsync(template, async tuple =>
5656
await Task.Delay(100);
5757
}
5858

59-
Console.WriteLine($"WORKER: Checking if {tuple} is still in space: {!(await agent.Peek(template)).IsEmpty}");
59+
Console.WriteLine($"WORKER: Checking if {tuple} is still in space: {!(await agent.PeekAsync(template)).IsEmpty}");
6060

6161
Console.WriteLine("\nPress any key to terminate...");
6262
Console.ReadKey();

samples/04_DelayedExec/Poper/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ await agent.PopAsync(template, async tuple =>
5656
await Task.Delay(100);
5757
}
5858

59-
Console.WriteLine($"WORKER: Checking if {tuple} is still in space: {!(await agent.Peek(template)).IsEmpty}");
59+
Console.WriteLine($"WORKER: Checking if {tuple} is still in space: {!(await agent.PeekAsync(template)).IsEmpty}");
6060

6161

6262
Console.WriteLine("\nPress any key to terminate...");

samples/07_ClientServer/Client/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
await agent.WriteAsync(clientTuple);
3737
Console.WriteLine($"WRITE: {clientTuple}");
3838

39-
SpaceTuple serverTuple = await agent.Peek(new("SERVER"));
39+
SpaceTuple serverTuple = await agent.PeekAsync(new("SERVER"));
4040
if (!serverTuple.IsEmpty)
4141
{
4242
Console.WriteLine($"READ: {serverTuple}");

samples/07_ClientServer/Server/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
await agent.WriteAsync(serverTuple);
3636
Console.WriteLine($"WRITE: {serverTuple}");
3737

38-
SpaceTuple clientTuple = await agent.Peek(new("CLIENT"));
38+
SpaceTuple clientTuple = await agent.PeekAsync(new("CLIENT"));
3939
if (!clientTuple.IsEmpty)
4040
{
4141
Console.WriteLine($"READ: {clientTuple}");

samples/Sandbox/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
Console.WriteLine("Connected to the tuple space.\n\n");
1818

19+
var agent = host.Services.GetService<ISpaceAgent>();
20+
21+
var a = await agent.ScanAsync(new(1, 1));
22+
23+
1924
// test anything here...
2025

2126
Console.WriteLine("\nPress any key to terminate...\n");

src/OrleanSpaces/Agents/SpaceAgent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public ValueTask EvaluateAsync(Func<Task<SpaceTuple>> evaluation)
100100
return evaluationChannel.Writer.WriteAsync(evaluation);
101101
}
102102

103-
public ValueTask<SpaceTuple> Peek(SpaceTemplate template)
103+
public ValueTask<SpaceTuple> PeekAsync(SpaceTemplate template)
104104
{
105105
var tuple = tuples.FirstOrDefault(x => template.Matches(x.Tuple));
106106
return new(tuple.Tuple);

src/OrleanSpaces/ISpaceAgent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface ISpaceAgent
5252
/// </summary>
5353
/// <param name="template">A template that potentially matches a <see cref="SpaceTuple"/>.</param>
5454
/// <returns><see cref="SpaceTuple"/> (potentially one with zero length).</returns>
55-
ValueTask<SpaceTuple> Peek(SpaceTemplate template);
55+
ValueTask<SpaceTuple> PeekAsync(SpaceTemplate template);
5656

5757
/// <summary>
5858
/// Reads a <see cref="SpaceTuple"/> that is potentially matched by the given <paramref name="template"/>.
@@ -63,7 +63,7 @@ public interface ISpaceAgent
6363
/// </summary>
6464
/// <param name="template">A template that potentially matches a <see cref="SpaceTuple"/>.</param>
6565
/// <param name="callback">A callback function that will be executed, with the <see cref="SpaceTuple"/> as the argument.</param>
66-
/// <remarks><i>Same as with <see cref="Peek(SpaceTemplate)"/>, the original tuple is <u>kept</u> in the space once <paramref name="callback"/> gets invoked.</i></remarks>
66+
/// <remarks><i>Same as with <see cref="PeekAsync(SpaceTemplate)"/>, the original tuple is <u>kept</u> in the space once <paramref name="callback"/> gets invoked.</i></remarks>
6767
ValueTask PeekAsync(SpaceTemplate template, Func<SpaceTuple, Task> callback);
6868

6969
/// <summary>
@@ -98,7 +98,7 @@ public interface ISpaceAgent
9898
/// Reads multiple <see cref="SpaceTuple"/>'s that are potentially matched by the given <paramref name="template"/>.
9999
/// </summary>
100100
/// <param name="template">A template that potentially matches multiple <see cref="SpaceTuple"/>'s.</param>
101-
/// <remarks><i>Same as with <see cref="Peek(SpaceTemplate)"/>, the original tuple's are <u>kept</u> in the space.</i></remarks>
101+
/// <remarks><i>Same as with <see cref="PeekAsync(SpaceTemplate)"/>, the original tuple's are <u>kept</u> in the space.</i></remarks>
102102
ValueTask<IEnumerable<SpaceTuple>> ScanAsync(SpaceTemplate template);
103103

104104
/// <summary>

0 commit comments

Comments
 (0)