Skip to content

Commit 079195e

Browse files
committed
refactor: improve XML documentation for Buffer and IBuffer interfaces
1 parent cfdb79e commit 079195e

File tree

4 files changed

+90
-120
lines changed

4 files changed

+90
-120
lines changed

src/net-questdb-client/Buffers/Buffer.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ namespace QuestDB.Buffers;
3131
/// </summary>
3232
public static class Buffer
3333
{
34-
/// <summary>
35-
/// Creates an IBuffer instance, based on the provided protocol version.
36-
/// </summary>
37-
/// <param name="bufferSize"></param>
38-
/// <param name="maxNameLen"></param>
39-
/// <param name="maxBufSize"></param>
40-
/// <param name="version"></param>
41-
/// <returns></returns>
4234
/// <summary>
4335
/// Creates a concrete IBuffer implementation configured for the specified protocol version.
4436
/// </summary>

src/net-questdb-client/Buffers/IBuffer.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,29 +229,29 @@ public interface IBuffer
229229
public IBuffer Column<T>(ReadOnlySpan<char> name, ReadOnlySpan<T> value) where T : struct;
230230

231231
/// <summary>
232-
/// Writes an array column value for the current row.
233-
/// </summary>
234-
/// <param name="name">The column name.</param>
235-
/// <param name="value">The array to write as the column value, or null to record a NULL value.</param>
236-
/// <returns>The same buffer instance for fluent chaining.</returns>
232+
/// Writes an array column value for the current row.
233+
/// </summary>
234+
/// <param name="name">The column name.</param>
235+
/// <param name="value">The array to write as the column value, or null to record a NULL value.</param>
236+
/// <returns>The same buffer instance for fluent chaining.</returns>
237237
public IBuffer Column(ReadOnlySpan<char> name, Array? value);
238238

239239
/// <summary>
240-
/// Writes a column with the specified name using the provided enumerable of values and shape information.
241-
/// </summary>
242-
/// <param name="name">The column name.</param>
243-
/// <param name="value">An enumerable of values for the column; elements are of the value type `T`.</param>
244-
/// <param name="shape">An enumerable of integers describing the multidimensional shape/length(s) for the values.</param>
245-
/// <returns>The same <see cref="IBuffer"/> instance for call chaining.</returns>
240+
/// Writes a column with the specified name using the provided enumerable of values and shape information.
241+
/// </summary>
242+
/// <param name="name">The column name.</param>
243+
/// <param name="value">An enumerable of values for the column; elements are of the value type `T`.</param>
244+
/// <param name="shape">An enumerable of integers describing the multidimensional shape/length(s) for the values.</param>
245+
/// <returns>The same <see cref="IBuffer"/> instance for call chaining.</returns>
246246
public IBuffer Column<T>(ReadOnlySpan<char> name, IEnumerable<T> value, IEnumerable<int> shape) where T : struct;
247247

248248
/// <summary>
249249
/// Records a DECIMAL column value using the ILP binary decimal layout.
250250
/// <summary>
251-
/// Writes a DECIMAL column with the specified name using the ILP binary decimal layout.
252-
/// </summary>
253-
/// <param name="name">The column name.</param>
254-
/// <param name="value">The decimal value to write, or `null` to write a NULL column.</param>
255-
/// <returns>The buffer instance for method chaining.</returns>
251+
/// Writes a DECIMAL column with the specified name using the ILP binary decimal layout.
252+
/// </summary>
253+
/// <param name="name">The column name.</param>
254+
/// <param name="value">The decimal value to write, or `null` to write a NULL column.</param>
255+
/// <returns>The buffer instance for method chaining.</returns>
256256
public IBuffer Column(ReadOnlySpan<char> name, decimal? value);
257257
}

src/net-questdb-client/Senders/HttpSender.cs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ private void Build()
149149
{
150150
_client.DefaultRequestHeaders.Authorization
151151
= new AuthenticationHeaderValue("Basic",
152-
Convert.ToBase64String(
153-
Encoding.ASCII.GetBytes(
154-
$"{Options.username}:{Options.password}")));
152+
Convert.ToBase64String(
153+
Encoding.ASCII.GetBytes(
154+
$"{Options.username}:{Options.password}")));
155155
}
156156
else if (!string.IsNullOrEmpty(Options.token))
157157
{
@@ -223,17 +223,14 @@ private CancellationTokenSource GenerateRequestCts(CancellationToken ct = defaul
223223
return cts;
224224
}
225225

226-
/// <summary>
227-
/// Creates a new HTTP request with appropriate encoding.
228-
/// </summary>
229226
/// <summary>
230227
/// Create an HTTP POST request targeting "/write" with the sender's buffer as the request body.
231228
/// </summary>
232229
/// <returns>An <see cref="HttpRequestMessage"/> configured with the buffer as the request body, Content-Type set to "text/plain" with charset "utf-8", and Content-Length set to the buffer length.</returns>
233230
private HttpRequestMessage GenerateRequest()
234231
{
235232
var request = new HttpRequestMessage(HttpMethod.Post, "/write")
236-
{ Content = new BufferStreamContent(Buffer), };
233+
{ Content = new BufferStreamContent(Buffer), };
237234
request.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain") { CharSet = "utf-8", };
238235
request.Content.Headers.ContentLength = Buffer.Length;
239236
return request;
@@ -260,21 +257,20 @@ public override ISender Transaction(ReadOnlySpan<char> tableName)
260257
if (WithinTransaction)
261258
{
262259
throw new IngressError(ErrorCode.InvalidApiCall,
263-
"Cannot start another transaction - only one allowed at a time.");
260+
"Cannot start another transaction - only one allowed at a time.");
264261
}
265262

266263
if (Length > 0)
267264
{
268265
throw new IngressError(ErrorCode.InvalidApiCall,
269-
"Buffer must be clear before you can start a transaction.");
266+
"Buffer must be clear before you can start a transaction.");
270267
}
271268

272269
Buffer.Transaction(tableName);
273270
return this;
274271
}
275272

276273
/// <inheritdoc cref="CommitAsync" />
277-
/// />
278274
public override void Commit(CancellationToken ct = default)
279275
{
280276
try
@@ -396,7 +392,8 @@ public override void Send(CancellationToken ct = default)
396392
/// <returns>The final <see cref="HttpResponseMessage"/> returned by the server for a successful request.</returns>
397393
/// <exception cref="IngressError">Thrown with <see cref="ErrorCode.ServerFlushError"/> when a connection could not be established within the allowed retries.</exception>
398394
/// <remarks>The caller is responsible for disposing the returned <see cref="HttpResponseMessage"/>./// </remarks>
399-
private HttpResponseMessage SendWithRetries(CancellationToken ct, Func<HttpRequestMessage> requestFactory, TimeSpan retryTimeout)
395+
private HttpResponseMessage SendWithRetries(CancellationToken ct, Func<HttpRequestMessage> requestFactory,
396+
TimeSpan retryTimeout)
400397
{
401398
HttpResponseMessage? response = null;
402399
CancellationTokenSource cts = GenerateRequestCts(ct);
@@ -414,9 +411,9 @@ private HttpResponseMessage SendWithRetries(CancellationToken ct, Func<HttpReque
414411
}
415412

416413
if (retryTimeout > TimeSpan.Zero)
417-
// retry if appropriate - error that's retriable, and retries are enabled
414+
// retry if appropriate - error that's retriable, and retries are enabled
418415
{
419-
if (response == null // if it was a cannot correct error
416+
if (response == null // if it was a cannot correct error
420417
|| (!response.IsSuccessStatusCode // or some other http error
421418
&& IsRetriableError(response.StatusCode)))
422419
{
@@ -426,9 +423,9 @@ private HttpResponseMessage SendWithRetries(CancellationToken ct, Func<HttpReque
426423

427424
while (retryTimer.Elapsed < retryTimeout // whilst we can still retry
428425
&& (
429-
response == null || // either we can't connect
430-
(!response.IsSuccessStatusCode && // or we have another http error
431-
IsRetriableError(response.StatusCode)))
426+
response == null || // either we can't connect
427+
(!response.IsSuccessStatusCode && // or we have another http error
428+
IsRetriableError(response.StatusCode)))
432429
)
433430
{
434431
retryInterval = TimeSpan.FromMilliseconds(Math.Min(retryInterval.TotalMilliseconds * 2, 1000));
@@ -460,7 +457,7 @@ private HttpResponseMessage SendWithRetries(CancellationToken ct, Func<HttpReque
460457
if (response == null)
461458
{
462459
throw new IngressError(ErrorCode.ServerFlushError,
463-
$"Cannot connect to `{Options.Host}:{Options.Port}`");
460+
$"Cannot connect to `{Options.Host}:{Options.Port}`");
464461
}
465462

466463
return response;
@@ -542,7 +539,7 @@ public override async Task SendAsync(CancellationToken ct = default)
542539
// retry if appropriate - error that's retriable, and retries are enabled
543540
if (Options.retry_timeout > TimeSpan.Zero)
544541
{
545-
if (response == null // if it was a cannot correct error
542+
if (response == null // if it was a cannot correct error
546543
|| (!response.IsSuccessStatusCode // or some other http error
547544
&& IsRetriableError(response.StatusCode)))
548545
{
@@ -552,9 +549,9 @@ public override async Task SendAsync(CancellationToken ct = default)
552549

553550
while (retryTimer.Elapsed < Options.retry_timeout // whilst we can still retry
554551
&& (
555-
response == null || // either we can't connect
556-
(!response.IsSuccessStatusCode && // or we have another http error
557-
IsRetriableError(response.StatusCode)))
552+
response == null || // either we can't connect
553+
(!response.IsSuccessStatusCode && // or we have another http error
554+
IsRetriableError(response.StatusCode)))
558555
)
559556
{
560557
retryInterval = TimeSpan.FromMilliseconds(Math.Min(retryInterval.TotalMilliseconds * 2, 1000));
@@ -574,7 +571,7 @@ public override async Task SendAsync(CancellationToken ct = default)
574571
try
575572
{
576573
response = await _client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead,
577-
cts.Token);
574+
cts.Token);
578575
}
579576
catch (HttpRequestException)
580577
{
@@ -588,7 +585,7 @@ public override async Task SendAsync(CancellationToken ct = default)
588585
if (response == null)
589586
{
590587
throw new IngressError(ErrorCode.ServerFlushError,
591-
$"Cannot connect to `{Options.Host}:{Options.Port}`");
588+
$"Cannot connect to `{Options.Host}:{Options.Port}`");
592589
}
593590

594591
// return if ok

0 commit comments

Comments
 (0)