Skip to content

Commit

Permalink
Replace the word "query" with the more appropriate "retrieve" in vari…
Browse files Browse the repository at this point in the history
…ous locations.

References #21
  • Loading branch information
andreashuber-lawo committed Apr 22, 2016
1 parent ee1b4b0 commit d0e364d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
19 changes: 10 additions & 9 deletions Lawo.EmberPlusSharp/Model/Consumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed class Consumer<TRoot> : IMonitoredConnection
private readonly StreamedParameterCollection streamedParameters = new StreamedParameterCollection();
private readonly TRoot root;
private readonly S101Client client;
private readonly int queryChildrenTimeout;
private readonly int childrenRetrievalTimeout;
private readonly S101Message emberDataMessage;
private int autoSendInterval = 100;
private CancellationTokenSource autoSendDelayCancellationSource;
Expand Down Expand Up @@ -201,7 +201,7 @@ public static async Task<Consumer<TRoot>> CreateAsync(
S101Client client, int timeout, ChildrenRequestPolicy childrenRequestPolicy, byte slot)
{
var result = new Consumer<TRoot>(client, timeout, childrenRequestPolicy, slot);
await result.QueryChildrenAsync();
await result.RetrieveChildrenAsync();
result.ReceiveLoop();
result.AutoSendLoop();
return result;
Expand All @@ -227,7 +227,7 @@ private Consumer(S101Client client, int timeout, ChildrenRequestPolicy childrenR
{
this.root = Root<TRoot>.Construct(new Context(null, 0, string.Empty, childrenRequestPolicy));
this.client = client;
this.queryChildrenTimeout = timeout;
this.childrenRetrievalTimeout = timeout;
this.emberDataMessage = new S101Message(slot, EmberDataCommand);
this.client.EmberDataReceived += this.receiveQueue.OnMessageReceived;
this.client.ConnectionLost += this.receiveQueue.OnConnectionLost;
Expand All @@ -246,11 +246,12 @@ private void OnHasChangesSet(object sender, EventArgs e)
this.hasChangesSetSource.TrySetResult(true);
}

private async Task QueryChildrenAsync()
private async Task RetrieveChildrenAsync()
{
var queryChildrenTask = this.QueryChildrenCoreAsync();
var retrieveChildrenTask = this.RetrieveChildrenCoreAsync();

if ((await Task.WhenAny(queryChildrenTask, Task.Delay(this.queryChildrenTimeout))) != queryChildrenTask)
if ((await Task.WhenAny(retrieveChildrenTask, Task.Delay(this.childrenRetrievalTimeout))) !=
retrieveChildrenTask)
{
this.root.UpdateRequestState(this.root.RequestState.Equals(RequestState.Complete));
var firstIncompleteNode = this.root.GetFirstIncompleteChild();
Expand All @@ -261,7 +262,7 @@ private async Task QueryChildrenAsync()
throw new TimeoutException(message);
}

await queryChildrenTask;
await retrieveChildrenTask;
}

private async void ReceiveLoop()
Expand All @@ -273,7 +274,7 @@ private async void ReceiveLoop()
while (true)
{
await this.WaitForAndApplyChanges();
await this.QueryChildrenAsync();
await this.RetrieveChildrenAsync();
}
}
catch (OperationCanceledException)
Expand Down Expand Up @@ -323,7 +324,7 @@ private async void AutoSendLoop()
}
}

private async Task QueryChildrenCoreAsync()
private async Task RetrieveChildrenCoreAsync()
{
while (await this.SendRequestAsync())
{
Expand Down
4 changes: 2 additions & 2 deletions Lawo.EmberPlusSharp/Model/ElementWithSchemas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public abstract class ElementWithSchemas<TMostDerived> : Element<TMostDerived>,
/// <item><see cref="Element.AreRequiredChildrenAvailable"/></item>
/// </list>
/// See individual method documentation for semantics. This rather complex system was implemented to make the
/// process of querying the provider as efficient as possible, namely:
/// process of retrieving elements from the provider as efficient as possible, namely:
/// <list type="bullet">
/// <item>As few as possible messages are sent to query for children and/or subscribe to streams.</item>
/// <item>As few as possible messages are sent to request children and/or subscribe to streams.</item>
/// <item>The computational effort for tree traversal is kept as low as possible. This is necessary because all
/// code is always executed on the applications GUI thread. Without these optimizations, a full tree traversal
/// would be necessary after each processed message. Some providers send a new message for each updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
<title>TCP Connection and S101</title>
<content>
<para>
Before we can query the provider we first need to create a connection and then establish the S101 protocol.
Since these first steps will be mostly the same whenever we'd like to connect to a provider, we'll put them
into a handy method:
Before we can retrieve data from the provider we first need to create a connection and then establish the S101
protocol. Since these first steps will be mostly the same whenever we'd like to connect to a provider, we'll
put them into a handy method:
</para>
<code source="..\Lawo.EmberPlusSharpTest\Model\TutorialTest.cs" region="S101 Connect Method" language="c#"/>
</content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<alert class="note">
<para>
Throughout its lifetime, a consumer automatically sends <codeInline>getDirectory</codeInline> commands to
query for children client code has declared interest in. This is done recursively down to leaf elements and
retrieve children client code has declared interest in. This is done recursively down to leaf elements and
new nodes are only announced through
<codeEntityReference>T:System.Collections.Specialized.INotifyCollectionChanged</codeEntityReference>
once all children (including grandchildren, great-grandchildren, etc.) have been received from the provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
databases of unknown contents.
</para>
<para>
The main difference between the dynamic and the static interface is that the former will query the provider for
all elements and replicate them in the local database while the latter will only query and replicate the
The main difference between the dynamic and the static interface is that the former will retrieve all elements
from the provider and replicate them in the local database while the latter will only retrieve and replicate the
elements that the client code is interested in. Apart from that the static interface offers a superset of
the functionality of the dynamic one.
</para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</list>
</listItem>
<listItem>
<para>Recursively query the provider for the parts of the tree the consumer is interested in.</para>
<para>Recursively retrieve from the provider the parts of the tree the consumer is interested in.</para>
</listItem>
<listItem>
<para>
Expand Down
2 changes: 1 addition & 1 deletion Lawo.EmberPlusSharpTest/Model/TutorialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private static void Main()
// Establish S101 protocol
using (S101Client client = await ConnectAsync("localhost", 9000))

// Query the provider database for *all* elements and store them in a local copy
// Retrieve *all* elements in the provider database and store them in a local copy
using (Consumer<MyRoot> consumer = await Consumer<MyRoot>.CreateAsync(client))
{
// Get the root of the local database.
Expand Down
2 changes: 1 addition & 1 deletion Lawo.EmberPlusSharpTestVB/Model/TutorialTest.vb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Public Class TutorialTestVB
Async Function()
' Establish S101 protocol
Using client As S101Client = Await ConnectAsync("localhost", 9000)
' Query the provider database for *all* elements and store them in a local copy
' Retrieve *all* elements in the provider database and store them in a local copy
Using con As Consumer(Of MyRoot) = Await Consumer(Of MyRoot).CreateAsync(client)
' Get the root of the local database.
Dim root As INode = con.Root
Expand Down

0 comments on commit d0e364d

Please sign in to comment.