Skip to content

Commit b1bb263

Browse files
committed
Improvements to generated documentation
Handle simple nested POCO type declarations Handle encoded generics inside of multline documentation comments Remove the opening and closing braces of an accessor declaration
1 parent 2128d05 commit b1bb263

34 files changed

+471
-283
lines changed

docs/asciidoc/Aggregations/WritingAggregations.doc.asciidoc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,17 @@ on the request. Using LINQ's `.Aggregate()` method, each function can be applied
6262

6363
[source, csharp]
6464
----
65+
var aggregations = new List<Func<AggregationContainerDescriptor<CommitActivity>, IAggregationContainer>>
6566
{
66-
var aggregations = new List<Func<AggregationContainerDescriptor<CommitActivity>, IAggregationContainer>>
67-
{
68-
a => a.Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor)),
69-
a => a.Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor))
70-
};
71-
72-
return s => s
73-
.Aggregations(aggs => aggs
74-
.Children<CommitActivity>("name_of_child_agg", child => child
75-
.Aggregations(childAggs =>
76-
aggregations.Aggregate(childAggs, (acc, agg) => { agg(acc); return acc; })
77-
)
67+
a => a.Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor)),
68+
a => a.Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor))
69+
};
70+
return s => s
71+
.Aggregations(aggs => aggs
72+
.Children<CommitActivity>("name_of_child_agg", child => child
73+
.Aggregations(childAggs =>
74+
aggregations.Aggregate(childAggs, (acc, agg) => { agg(acc); return acc; })
7875
)
79-
);
80-
}
76+
)
77+
);
8178
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/ConnectionPooling.Doc.asciidoc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Connection pooling is the internal mechanism that takes care of registering what nodes there are in the cluster and which
33
we can use to issue client calls on.
44

5-
== SingleNodeConnectionPool
5+
== SingleNodeConnectionPool
66
The simplest of all connection pools, this takes a single `Uri` and uses that to connect to elasticsearch for all the calls
77
It doesn't opt in to sniffing and pinging behavior, and will never mark nodes dead or alive. The one `Uri` it holds is always
8-
ready to go.
8+
ready to go.
99

1010
[source, csharp]
1111
----
@@ -15,7 +15,7 @@ pool.Nodes.Should().HaveCount(1);
1515
var node = pool.Nodes.First();
1616
node.Uri.Port.Should().Be(9201);
1717
----
18-
This type of pool is hardwired to optout out sniffing
18+
This type of pool is hardwired to opt out of sniffing
1919

2020
[source, csharp]
2121
----
@@ -27,7 +27,7 @@ and pinging
2727
----
2828
pool.SupportsPinging.Should().BeFalse();
2929
----
30-
When you use the low ceremony ElasticClient constructor that takes a single Uri
30+
When you use the low ceremony ElasticClient constructor that takes a single Uri,
3131
We default to this SingleNodeConnectionPool
3232

3333
[source, csharp]
@@ -58,15 +58,15 @@ client = new ElasticClient(new ConnectionSettings(pool));
5858
----
5959
client.ConnectionSettings.ConnectionPool.Should().BeOfType<SingleNodeConnectionPool>();
6060
----
61-
== StaticConnectionPool
62-
The static connection pool is great if you have a known small sized cluster and do no want to enable
61+
== StaticConnectionPool
62+
The static connection pool is great if you have a known small sized cluster and do no want to enable
6363
sniffing to find out the cluster topology.
6464

6565
[source, csharp]
6666
----
6767
var uris = Enumerable.Range(9200, 5).Select(p => new Uri("http://localhost:" + p));
6868
----
69-
a connection pool can be seeded using an enumerable of `Uri`
69+
a connection pool can be seeded using an enumerable of `Uri`s
7070

7171
[source, csharp]
7272
----
@@ -82,7 +82,7 @@ var nodes = uris.Select(u=>new Node(u));
8282
----
8383
pool = new StaticConnectionPool(nodes);
8484
----
85-
This type of pool is hardwirted to optout out sniffing
85+
This type of pool is hardwired to opt out of sniffing
8686

8787
[source, csharp]
8888
----
@@ -105,9 +105,9 @@ var client = new ElasticClient(new ConnectionSettings(pool));
105105
----
106106
client.ConnectionSettings.ConnectionPool.Should().BeOfType<StaticConnectionPool>();
107107
----
108-
== SniffingConnectionPool
108+
== SniffingConnectionPool
109109
A subclass of StaticConnectionPool that allows itself to be reseeded at run time.
110-
It comes with a very minor overhead of a ReaderWriterLock to ensure thread safety.
110+
It comes with a very minor overhead of a `ReaderWriterLockSlim` to ensure thread safety.
111111

112112
[source, csharp]
113113
----
@@ -132,19 +132,19 @@ var nodes = uris.Select(u=>new Node(u));
132132
----
133133
pool = new SniffingConnectionPool(nodes);
134134
----
135-
This type of pool is hardwired to opt out of sniffing
135+
This type of pool is hardwired to opt in to sniffing
136136

137137
[source, csharp]
138138
----
139139
pool.SupportsReseeding.Should().BeTrue();
140140
----
141-
but supports pinging when enabled
141+
and pinging
142142

143143
[source, csharp]
144144
----
145145
pool.SupportsPinging.Should().BeTrue();
146146
----
147-
To create a client using this siffing connection pool pass
147+
To create a client using the sniffing connection pool pass
148148
the connection pool to the connectionsettings you pass to ElasticClient
149149

150150
[source, csharp]

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/DateTimeProviders.Doc.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= Date time providers
22

3-
Not typically something you'll have to pass to the client but all calls `to DateTime.Now`
4-
in the client have been abstracted by IDateTimeProvider. This allows us to unit test timeouts and clusterfailover
3+
Not typically something you'll have to pass to the client but all calls to `System.DateTime.UtcNow`
4+
in the client have been abstracted by `IDateTimeProvider`. This allows us to unit test timeouts and clusterfailover
55
in run time not being bound to wall clock time.
66

77
[source, csharp]
@@ -14,8 +14,8 @@ dates are always returned in UTC
1414
----
1515
dateTimeProvider.Now().Should().BeCloseTo(DateTime.UtcNow);
1616
----
17-
Another responsibility of this interface is to calculate the time a node has to taken out of rotation
18-
based on the number of attempts to revive it. For very advance usecases this might be something of interest
17+
Another responsibility of this interface is to calculate the time a node has to be taken out of rotation
18+
based on the number of attempts to revive it. For very advanced use cases, this might be something of interest
1919
to provide a custom implementation for.
2020

2121
[source, csharp]
@@ -38,8 +38,8 @@ Plotting these defaults looks as followed:
3838
[[timeout]]
3939
.Default formula, x-axis time in minutes, y-axis number of attempts to revive
4040
image::timeoutplot.png[dead timeout]
41-
The goal here is that whenever a node is resurected and is found to still be offline we send it
42-
back to the doghouse for an ever increasingly long period untill we hit a bounded maximum.
41+
The goal here is that whenever a node is resurrected and is found to still be offline, we send it
42+
_back to the doghouse_ for an ever increasingly long period, until we hit a bounded maximum.
4343

4444
[source, csharp]
4545
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/KeepingTrackOfNodes.Doc.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
=
1+
= Keeping track of nodes
22

33

44
[source, csharp]
@@ -23,8 +23,8 @@ Is resurrected is true on first usage, hints to the transport that a ping might
2323
----
2424
node.IsResurrected.Should().BeTrue();
2525
----
26-
When instantiating your connection pool you could switch these to false to initialize the client to
27-
a known cluster topology.
26+
When instantiating your connection pool you could switch these to false to initialize the client to
27+
a known cluster topology.
2828

2929
passing a node with a path should be preserved. Sometimes an elasticsearch node lives behind a proxy
3030

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/RequestPipelines.doc.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
== Request pipeline
2-
Every request is executed in the context of `RequestPipeline` when you are using the default `ITransport` implementation.
1+
= Request pipeline
2+
Every request is executed in the context of `RequestPipeline` when using the default `ITransport` implementation.
33

44

55
[source, csharp]
@@ -34,7 +34,7 @@ which can be passed to the transport when instantiating a client
3434
----
3535
var transport = new Transport<ConnectionSettings>(settings, requestPipelineFactory, DateTimeProvider.Default, new MemoryStreamFactory());
3636
----
37-
this allows you to have requests executed on your own custom request pipeline
37+
this allows you to have requests executed on your own custom request pipeline
3838

3939
[source, csharp]
4040
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/Transports.Doc.asciidoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
== Transports
2-
The ITransport interface can be seen as the motor block of the client. It's interface is deceitfully simple.
3-
Its ultimately responsible from translating a client call to a response. If for some reasons you do not agree with the way we wrote
4-
the internals of the client by implementing a custom ITransport you can circumvent all of it and introduce your own.
1+
= Transports
2+
The `ITransport` interface can be seen as the motor block of the client. It's interface is deceitfully simple.
3+
It's ultimately responsible from translating a client call to a response. If for some reason you do not agree with the way we wrote
4+
the internals of the client, by implementing a custom `ITransport`, you can circumvent all of it and introduce your own.
55

66

77
Transport is generically typed to a type that implements IConnectionConfigurationValues
88
This is the minimum ITransport needs to report back for the client to function.
9-
e.g in the low level client transport is instantiated like this:
9+
e.g in the low level client, transport is instantiated like this:
1010

1111
[source, csharp]
1212
----
1313
var lowLevelTransport = new Transport<ConnectionConfiguration>(new ConnectionConfiguration());
1414
----
15-
In the high level client like this.
15+
In the high level client like this:
1616

1717
[source, csharp]
1818
----
@@ -23,9 +23,9 @@ var highlevelTransport = new Transport<ConnectionSettings>(new ConnectionSetting
2323
var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
2424
var inMemoryTransport = new Transport<ConnectionSettings>(new ConnectionSettings(connectionPool, new InMemoryConnection()));
2525
----
26-
The only two methods on ITransport are Request and DoRequestAsync, the default ITransport implementation is responsible for introducing
27-
many of the building blocks in the client, if these do not work for you can swap them out for your own custom ITransport implementation.
28-
If you feel this need report back to us we would love to learn why you'd go down this route!
26+
The only two methods on `ITransport` are `Request()` and `RequestAsync()`, the default `ITransport` implementation is responsible for introducing
27+
many of the building blocks in the client, if these do not work for you can swap them out for your own custom `ITransport` implementation.
28+
If you feel this need, please let us know as we'd love to learn why you've go down this route!
2929

3030
[source, csharp]
3131
----

docs/asciidoc/ClientConcepts/ConnectionPooling/Exceptions/UnexpectedExceptions.doc.asciidoc

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
== Unexpected exceptions
1+
== Unexpected exceptions
22
When a client call throws an exception that the IConnction can not handle, this exception will bubble
33
out the client as an UnexpectedElasticsearchClientException, regardless whether the client is configured to throw or not.
4-
An IConnection is in charge of knowning what exceptions it can recover from or not. The default IConnection that is based on WebRequest can and
4+
An IConnection is in charge of knowning what exceptions it can recover from or not. The default IConnection that is based on WebRequest can and
55
will recover from WebExceptions but others will be grounds for immediately exiting the pipeline.
66

77
[source, csharp]
@@ -33,10 +33,10 @@ e.FailureReason.Should().Be(PipelineFailure.Unexpected);
3333
e.InnerException.Should().NotBeNull();
3434
e.InnerException.Message.Should().Be("boom!");
3535
----
36-
Sometimes an unexpected exception happens further down in the pipeline, this is why we
37-
wrap them inside an UnexpectedElasticsearchClientException so that information about where
36+
Sometimes an unexpected exception happens further down in the pipeline, this is why we
37+
wrap them inside an UnexpectedElasticsearchClientException so that information about where
3838
in the pipeline the unexpected exception is not lost, here a call to 9200 fails using a webexception.
39-
It then falls over to 9201 which throws an hard exception from within IConnection. We assert that we
39+
It then falls over to 9201 which throws an hard exception from within IConnection. We assert that we
4040
can still see the audit trail for the whole coordinated request.
4141

4242
[source, csharp]
@@ -94,28 +94,12 @@ audit = await audit.TraceUnexpectedException(
9494
(e) =>
9595
{
9696
e.FailureReason.Should().Be(PipelineFailure.Unexpected);
97-
----
98-
InnerException is the exception that brought the request down
99-
100-
[source, csharp]
101-
----
10297
e.InnerException.Should().NotBeNull();
10398
e.InnerException.Message.Should().Be("boom!");
104-
----
105-
The hard exception that happened on ping is still available though
106-
107-
[source, csharp]
108-
----
10999
e.SeenExceptions.Should().NotBeEmpty();
110100
var pipelineException = e.SeenExceptions.First();
111101
pipelineException.FailureReason.Should().Be(PipelineFailure.PingFailure);
112102
pipelineException.InnerException.Message.Should().Be("ping exception");
113-
----
114-
Seen exception is hard to relate back to a point in time, the exception is also
115-
available on the audit trail
116-
117-
[source, csharp]
118-
----
119103
var pingException = e.AuditTrail.First(a => a.Event == AuditEvent.PingFailure).Exception;
120104
pingException.Should().NotBeNull();
121105
pingException.Message.Should().Be("ping exception");

docs/asciidoc/ClientConcepts/ConnectionPooling/Exceptions/UnrecoverableExceptions.doc.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
== Unrecoverable exceptions
2-
Unrecoverable exceptions are excepted exceptions that are grounds to exit the client pipeline immediately.
3-
By default the client won't throw on any ElasticsearchClientException but return an invalid response.
1+
== Unrecoverable exceptions
2+
Unrecoverable exceptions are excepted exceptions that are grounds to exit the client pipeline immediately.
3+
By default the client won't throw on any ElasticsearchClientException but return an invalid response.
44
You can configure the client to throw using ThrowExceptions() on ConnectionSettings. The following test
5-
both a client that throws and one that returns an invalid response with an `.OriginalException` exposed
5+
both a client that throws and one that returns an invalid response with an `.OriginalException` exposed
66

77
[source, csharp]
88
----

docs/asciidoc/ClientConcepts/ConnectionPooling/Failover/FallingOver.doc.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
== Fail over
2-
When using connection pooling and the pool has sufficient nodes a request will be retried if
2+
When using connection pooling and the pool has sufficient nodes a request will be retried if
33
the call to a node throws an exception or returns a 502 or 503
44

55
[source, csharp]
@@ -19,7 +19,7 @@ audit = await audit.TraceCall(
1919
);
2020
----
2121
502 Bad Gateway
22-
Will be treated as an error that requires retrying
22+
Will be treated as an error that requires retrying
2323

2424
[source, csharp]
2525
----
@@ -38,7 +38,7 @@ audit = await audit.TraceCall(
3838
);
3939
----
4040
503 Service Unavailable
41-
Will be treated as an error that requires retrying
41+
Will be treated as an error that requires retrying
4242

4343
[source, csharp]
4444
----

docs/asciidoc/ClientConcepts/ConnectionPooling/MaxRetries/RespectsMaxRetry.doc.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ audit = await audit.TraceCall(
2727
}
2828
);
2929
----
30-
When you have a 100 node cluster you might want to ensure a fixed number of retries.
31-
Remember that the actual number of requests is initial attempt + set number of retries
30+
When you have a 100 node cluster you might want to ensure a fixed number of retries.
31+
Remember that the actual number of requests is initial attempt + set number of retries
3232

3333
[source, csharp]
3434
----
@@ -118,8 +118,8 @@ audit = await audit.TraceCall(
118118
);
119119
----
120120

121-
This makes setting any retry setting on a single node connection pool a NOOP, this is by design!
122-
Connection pooling and connection failover is about trying to fail sanely whilst still utilizing available resources and
121+
This makes setting any retry setting on a single node connection pool a NOOP, this is by design!
122+
Connection pooling and connection failover is about trying to fail sanely whilst still utilizing available resources and
123123
not giving up on the fail fast principle. It's *NOT* a mechanism for forcing requests to succeed.
124124

125125
[source, csharp]

0 commit comments

Comments
 (0)