Skip to content

Commit 3f2b72c

Browse files
authored
feat: ILP Auth, TSL transport, Async API
2 parents a5641e6 + d2fe9f0 commit 3f2b72c

File tree

10 files changed

+1947
-401
lines changed

10 files changed

+1947
-401
lines changed

README.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,71 @@
55
- Basic usage
66

77
```c#
8-
using var ls = new LineTcpSender(IPAddress.Loopback.ToString(), 9009);
8+
using var ls = await LineTcpSender.ConnectAsync("localhost", 9009, tlsMode: TlsMode.Disable);
99
ls.Table("metric_name")
1010
.Symbol("Symbol", "value")
11-
.Colum("number", 10)
12-
.Colum("double", 12.23)
13-
.Colum("string", "born to shine")
11+
.Column("number", 10)
12+
.Column("double", 12.23)
13+
.Column("string", "born to shine")
1414
.At(new DateTime(2021, 11, 25, 0, 46, 26));
15-
ls.Flush();
15+
await ls.SendAsync();
1616
```
1717

1818
- Multi-line send
1919

2020
```c#
21-
using var ls = new LineTcpSender(IPAddress.Loopback.ToString(), 9009);
21+
using var ls = new LineTcpSender("localhost", 9009, tlsMode: TlsMode.Disable);
2222
for(int i = 0; i < 1E6; i++)
2323
{
2424
ls.Table("metric_name")
25-
.Colum("counter", i)
25+
.Column("counter", i)
2626
.AtNow();
2727
}
28-
ls.Flush();
28+
ls.Send();
2929
```
30+
31+
- Authenticated
32+
```c#
33+
using var ls = new LineTcpSender("localhost", 9009);
34+
await ls.Authenticate("admin", "NgdiOWDoQNUP18WOnb1xkkEG5TzPYMda5SiUOvT1K0U=");
35+
ls.Table("metric_name")
36+
.Column("counter", i)
37+
.AtNow();
38+
await ls.SendAsync();
39+
```
40+
41+
- Fixed IO Buffer size
42+
```c#
43+
using var ls = new LineTcpSender("localhost", 9009, bufferOverflowHandling: BufferOverflowHandling.SendImmediately);
44+
await ls.Authenticate("admin", "NgdiOWDoQNUP18WOnb1xkkEG5TzPYMda5SiUOvT1K0U=");
45+
ls.Table("metric_name")
46+
.Column("counter", i)
47+
.AtNow();
48+
await ls.SendAsync();
49+
```
50+
51+
### Construction parameters
52+
53+
| Name | Default | Description |
54+
|--------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
55+
| `host` | | Host or IP address of QuestDB server |
56+
| `port` | | QuestDB Port. Default ILP port is 9009 |
57+
| `bufferSize` | 4096 | Default send buffer size |
58+
| `bufferOverflowHandling` | `Extend` | There are 2 modes: <br/> - `Extend` will grow input buffer until `Send()` or `SendAsync()` method called<br/> - `SendImmediately` will no extend the IO Buffer and automatically executes `Send()` immediatly when IO Buffer overflown |
59+
| `tslMode` | `Enable` | There are 3 TSL modes:<br/>- `Enable`. TLS is enabled, sever certificate is checked<br/> - `AllowAnyServerCertificate`. TLS enabled, server certificate is not checked<br/>- `Disable` |
60+
61+
### Properties and methods
62+
63+
| Name | Description |
64+
|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
65+
| `AuthenticateAsync(string keyId, string privateKey)` | Authenticates with QuestDB certificates |
66+
| `Table(string name)` | Starts new line from table name |
67+
| `Symbol(string sybolName, string value)` | Symbol column value |
68+
| `Column(stirng columnName, string / long / double / DateTime value)` | Column name and value |
69+
| `At(DateTime / long timestamp)` | Designated timestamp for the line |
70+
| `AtNow()` | Finishes line leaving QuestDB sever to set the timestamp |
71+
| `Send() / SendAsync() ` | Send IO Buffers to QuestDB |
72+
| `CancelLine()` | Cancels current line. Works only when `bufferOverflowHandling` set to `Extend` |
73+
| `TrimExcessBuffers()` | Trims empty buffers used to grow IO Buffer. Only useful when `bufferOverflowHandling` set to `Extend` |
74+
| int `WriteTimeout` | Value, in milliseconds, that determines how long the underlying stream will attempt to write before timing out |
75+
| `IsConnected` | Indicates if the connection to QuestDB open |

0 commit comments

Comments
 (0)