@@ -195,7 +195,7 @@ namespace questdb::ilp
195
195
* auto validated = "A UTF-8 encoded string"_utf8;
196
196
* @endcode
197
197
*/
198
- utf8_view operator " " _utf8(const char * buf, size_t len)
198
+ inline utf8_view operator " " _utf8(const char * buf, size_t len)
199
199
{
200
200
return utf8_view{buf, len};
201
201
}
@@ -206,7 +206,7 @@ namespace questdb::ilp
206
206
* auto table_name = "events"_tn;
207
207
* @endcode
208
208
*/
209
- table_name_view operator " " _tn(const char * buf, size_t len)
209
+ inline table_name_view operator " " _tn(const char * buf, size_t len)
210
210
{
211
211
return table_name_view{buf, len};
212
212
}
@@ -217,7 +217,7 @@ namespace questdb::ilp
217
217
* auto column_name = "events"_cn;
218
218
* @endcode
219
219
*/
220
- column_name_view operator " " _cn(const char * buf, size_t len)
220
+ inline column_name_view operator " " _cn(const char * buf, size_t len)
221
221
{
222
222
return column_name_view{buf, len};
223
223
}
@@ -271,11 +271,10 @@ namespace questdb::ilp
271
271
line_sender_buffer (
272
272
size_t init_capacity,
273
273
size_t max_name_len) noexcept
274
- : _impl{:: line_sender_buffer_with_max_name_len (max_name_len) }
274
+ : _impl{nullptr }
275
275
, _init_capacity{init_capacity}
276
276
, _max_name_len{max_name_len}
277
277
{
278
- ::line_sender_buffer_reserve (_impl, init_capacity);
279
278
}
280
279
281
280
line_sender_buffer (const line_sender_buffer& other) noexcept
@@ -297,7 +296,10 @@ namespace questdb::ilp
297
296
if (this != &other)
298
297
{
299
298
::line_sender_buffer_free (_impl);
300
- _impl = ::line_sender_buffer_clone (other._impl );
299
+ if (other._impl )
300
+ _impl = ::line_sender_buffer_clone (other._impl );
301
+ else
302
+ _impl = nullptr ;
301
303
_init_capacity = other._init_capacity ;
302
304
_max_name_len = other._max_name_len ;
303
305
}
@@ -333,13 +335,9 @@ namespace questdb::ilp
333
335
size_t capacity () const noexcept
334
336
{
335
337
if (_impl)
336
- {
337
338
return ::line_sender_buffer_capacity (_impl);
338
- }
339
339
else
340
- {
341
- return _init_capacity;
342
- }
340
+ return 0 ;
343
341
}
344
342
345
343
size_t size () const noexcept
@@ -381,17 +379,13 @@ namespace questdb::ilp
381
379
void clear_marker () noexcept
382
380
{
383
381
if (_impl)
384
- {
385
382
::line_sender_buffer_clear_marker (_impl);
386
- }
387
383
}
388
384
389
385
void clear () noexcept
390
386
{
391
387
if (_impl)
392
- {
393
388
::line_sender_buffer_clear (_impl);
394
- }
395
389
}
396
390
397
391
/* *
@@ -566,7 +560,7 @@ namespace questdb::ilp
566
560
::line_sender_buffer_free (_impl);
567
561
}
568
562
private:
569
- void may_init ()
563
+ inline void may_init ()
570
564
{
571
565
if (!_impl)
572
566
{
@@ -788,6 +782,7 @@ namespace questdb::ilp
788
782
*/
789
783
void flush (line_sender_buffer& buffer)
790
784
{
785
+ buffer.may_init ();
791
786
ensure_impl ();
792
787
line_sender_error::wrapped_call (
793
788
::line_sender_flush,
@@ -803,11 +798,23 @@ namespace questdb::ilp
803
798
*/
804
799
void flush_and_keep (const line_sender_buffer& buffer)
805
800
{
806
- ensure_impl ();
807
- line_sender_error::wrapped_call (
808
- ::line_sender_flush_and_keep,
809
- _impl,
810
- buffer._impl );
801
+ if (buffer._impl )
802
+ {
803
+ ensure_impl ();
804
+ line_sender_error::wrapped_call (
805
+ ::line_sender_flush_and_keep,
806
+ _impl,
807
+ buffer._impl );
808
+ }
809
+ else
810
+ {
811
+ line_sender_buffer buffer2{0 };
812
+ buffer2.may_init ();
813
+ line_sender_error::wrapped_call (
814
+ ::line_sender_flush_and_keep,
815
+ _impl,
816
+ buffer2._impl );
817
+ }
811
818
}
812
819
813
820
/* *
0 commit comments