Skip to content

Commit 6068e7f

Browse files
committed
renamed user -> username; pass -> password;
1 parent f43913e commit 6068e7f

File tree

11 files changed

+88
-110
lines changed

11 files changed

+88
-110
lines changed

include/questdb/ingress/line_sender.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ bool line_sender_opts_bind_interface(
624624
* Also see `pass`.
625625
*/
626626
LINESENDER_API
627-
bool line_sender_opts_user(
627+
bool line_sender_opts_username(
628628
line_sender_opts* opts,
629629
line_sender_utf8 user,
630630
line_sender_error** err_out);
@@ -634,7 +634,7 @@ bool line_sender_opts_user(
634634
* Also see `user`.
635635
*/
636636
LINESENDER_API
637-
bool line_sender_opts_pass(
637+
bool line_sender_opts_password(
638638
line_sender_opts* opts,
639639
line_sender_utf8 pass,
640640
line_sender_error** err_out);
@@ -857,16 +857,6 @@ bool line_sender_flush_and_keep(
857857
const line_sender_buffer* buffer,
858858
line_sender_error** err_out);
859859

860-
/// Variant of `.flush()` that does not clear the buffer and allows for
861-
/// transactional flushes.
862-
///
863-
/// A transactional flush is simply a flush that ensures that all rows in
864-
/// the ILP buffer refer to the same table, thus allowing the server to
865-
/// treat the flush request as a single transaction.
866-
///
867-
/// This is because QuestDB does not support transactions spanning multiple
868-
/// tables.
869-
870860
/**
871861
* Variant of `.flush()` that does not clear the buffer and allows for
872862
* transactional flushes.

include/questdb/ingress/line_sender.hpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -831,21 +831,6 @@ namespace questdb::ingress
831831
return *this;
832832
}
833833

834-
// /**
835-
// * Set the username for authentication.
836-
// *
837-
// * For TCP this is the `kid` part of the ECDSA key set.
838-
// * The other fields are `token` `token_x` and `token_y`.
839-
// *
840-
// * For HTTP this is part of basic authentication.
841-
// * Also see `pass`.
842-
// */
843-
// LINESENDER_API
844-
// bool line_sender_opts_user(
845-
// line_sender_opts* opts,
846-
// line_sender_utf8 user,
847-
// line_sender_error** err_out);
848-
849834
/**
850835
* Set the username for basic HTTP authentication.
851836
*
@@ -855,10 +840,10 @@ namespace questdb::ingress
855840
* For HTTP this is part of basic authentication.
856841
* Also see `pass`.
857842
*/
858-
opts& user(utf8_view user)
843+
opts& username(utf8_view user)
859844
{
860845
line_sender_error::wrapped_call(
861-
::line_sender_opts_user,
846+
::line_sender_opts_username,
862847
_impl,
863848
user._impl);
864849
return *this;
@@ -871,7 +856,7 @@ namespace questdb::ingress
871856
opts& pass(utf8_view pass)
872857
{
873858
line_sender_error::wrapped_call(
874-
::line_sender_opts_pass,
859+
::line_sender_opts_password,
875860
_impl,
876861
pass._impl);
877862
return *this;

questdb-rs-ffi/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,10 @@ pub unsafe extern "C" fn line_sender_buffer_at_now(
890890
pub struct line_sender_opts(SenderBuilder);
891891

892892
/// Create a new `ops` instance from configuration string.
893-
/// The format of the string is: "tcp::addr=host:port;ket=value;...;"
893+
/// The format of the string is: "tcp::addr=host:port;key=value;...;"
894894
/// Alongside "tcp" you can also specify "tcps", "http", and "https".
895895
/// The accepted set of keys and values is the same as for the opt's API.
896-
/// E.g. "tcp::addr=host:port;user=alice;password=secret;tls_ca=os_roots;"
896+
/// E.g. "tcp::addr=host:port;username=alice;password=secret;tls_ca=os_roots;"
897897
#[no_mangle]
898898
pub unsafe extern "C" fn line_sender_opts_from_conf(
899899
config: line_sender_utf8,
@@ -978,25 +978,25 @@ pub unsafe extern "C" fn line_sender_opts_bind_interface(
978978
/// The other fields are `token` `token_x` and `token_y`.
979979
///
980980
/// For HTTP this is part of basic authentication.
981-
/// Also see `pass`.
981+
/// Also see `password`.
982982
#[no_mangle]
983-
pub unsafe extern "C" fn line_sender_opts_user(
983+
pub unsafe extern "C" fn line_sender_opts_username(
984984
opts: *mut line_sender_opts,
985-
user: line_sender_utf8,
985+
username: line_sender_utf8,
986986
err_out: *mut *mut line_sender_error,
987987
) -> bool {
988-
upd_opts!(opts, err_out, user, user.as_str())
988+
upd_opts!(opts, err_out, username, username.as_str())
989989
}
990990

991991
/// Set the password for basic HTTP authentication.
992-
/// Also see `user`.
992+
/// Also see `username`.
993993
#[no_mangle]
994-
pub unsafe extern "C" fn line_sender_opts_pass(
994+
pub unsafe extern "C" fn line_sender_opts_password(
995995
opts: *mut line_sender_opts,
996-
pass: line_sender_utf8,
996+
password: line_sender_utf8,
997997
err_out: *mut *mut line_sender_error,
998998
) -> bool {
999-
upd_opts!(opts, err_out, pass, pass.as_str())
999+
upd_opts!(opts, err_out, password, password.as_str())
10001000
}
10011001

10021002
/// Token (Bearer) Authentication Parameters for ILP over HTTP,
@@ -1201,7 +1201,7 @@ pub unsafe extern "C" fn line_sender_build(
12011201
/// The format of the string is: "tcp::addr=host:port;key=value;...;"
12021202
/// Alongside "tcp" you can also specify "tcps", "http", and "https".
12031203
/// The accepted set of keys and values is the same as for the opt's API.
1204-
/// E.g. "tcp::addr=host:port;user=alice;password=secret;tls_ca=os_roots;"
1204+
/// E.g. "tcp::addr=host:port;username=alice;password=secret;tls_ca=os_roots;"
12051205
///
12061206
/// For full list of options, search this header for `bool line_sender_opts_`.
12071207
#[no_mangle]

questdb-rs/examples/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() -> Result<()> {
1212
.parse()
1313
.unwrap();
1414
let mut sender = SenderBuilder::new_tcp(host, port)
15-
.user("testUser1")? // kid
15+
.username("testUser1")? // kid
1616
.token("5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48")? // d
1717
.token_x("fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU")? // x
1818
.token_y("Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac")? // y

questdb-rs/examples/auth_tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() -> Result<()> {
1212
.parse()
1313
.unwrap();
1414
let mut sender = SenderBuilder::new_tcp(host, port)
15-
.user("testUser1")? // kid
15+
.username("testUser1")? // kid
1616
.token("5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48")? // d
1717
.token_x("fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU")? // x
1818
.token_y("Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac")? // y

questdb-rs/examples/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use questdb::{
44
};
55

66
fn main() -> Result<()> {
7-
let mut sender = Sender::from_conf("https::addr=localhost:9000;user=foo;pass=bar;")?;
7+
let mut sender = Sender::from_conf("https::addr=localhost:9000;username=foo;password=bar;")?;
88
let mut buffer = Buffer::new();
99
buffer
1010
.table("sensors")?

questdb-rs/src/ingress/mod.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
//! # fn main() -> Result<()> {
8989
//! // See: https://questdb.io/docs/reference/api/ilp/authenticate
9090
//! let mut sender = SenderBuilder::new_tcp("localhost", 9009)
91-
//! .user("testUser1")? // kid
91+
//! .username("testUser1")? // kid
9292
//! .token("5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48")? // d
9393
//! .token_x("fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU")? // x
9494
//! .token_y("Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac")? // y
@@ -1704,8 +1704,8 @@ pub struct SenderBuilder {
17041704
net_interface: ConfigSetting<Option<String>>,
17051705
max_buf_size: ConfigSetting<usize>,
17061706
auth_timeout: ConfigSetting<Duration>,
1707-
user: ConfigSetting<Option<String>>,
1708-
pass: ConfigSetting<Option<String>>,
1707+
username: ConfigSetting<Option<String>>,
1708+
password: ConfigSetting<Option<String>>,
17091709
token: ConfigSetting<Option<String>>,
17101710
token_x: ConfigSetting<Option<String>>,
17111711
token_y: ConfigSetting<Option<String>>,
@@ -1724,7 +1724,7 @@ pub struct SenderBuilder {
17241724
impl SenderBuilder {
17251725
/// Create a new `SenderBuilder` instance from configuration string.
17261726
///
1727-
/// The format of the string is: `"http::addr=host:port;ket=value;...;"`.
1727+
/// The format of the string is: `"http::addr=host:port;key=value;...;"`.
17281728
///
17291729
/// Alongside `"http"` you can also specify `"https"`, `"tcp"`, and `"tcps"`.
17301730
///
@@ -1734,7 +1734,7 @@ impl SenderBuilder {
17341734
///
17351735
/// The accepted set of keys and values is the same as for the `SenderBuilder`'s API.
17361736
///
1737-
/// E.g. `"http::addr=host:port;user=alice;password=secret;tls_ca=os_roots;"`.
1737+
/// E.g. `"http::addr=host:port;username=alice;password=secret;tls_ca=os_roots;"`.
17381738
///
17391739
/// If you prefer, you can also load the configuration from an environment variable.
17401740
/// See [`SenderBuilder::from_env`].
@@ -1780,8 +1780,8 @@ impl SenderBuilder {
17801780

17811781
for (key, val) in params.iter().map(|(k, v)| (k.as_str(), v.as_str())) {
17821782
builder = match key {
1783-
"user" => builder.user(val)?,
1784-
"pass" => builder.pass(val)?,
1783+
"username" => builder.username(val)?,
1784+
"password" => builder.password(val)?,
17851785
"token" => builder.token(val)?,
17861786
"token_x" => builder.token_x(val)?,
17871787
"token_y" => builder.token_y(val)?,
@@ -1918,8 +1918,8 @@ impl SenderBuilder {
19181918
net_interface: ConfigSetting::new_default(None),
19191919
max_buf_size: ConfigSetting::new_default(100 * 1024 * 1024),
19201920
auth_timeout: ConfigSetting::new_default(Duration::from_secs(15)),
1921-
user: ConfigSetting::new_default(None),
1922-
pass: ConfigSetting::new_default(None),
1921+
username: ConfigSetting::new_default(None),
1922+
password: ConfigSetting::new_default(None),
19231923
token: ConfigSetting::new_default(None),
19241924
token_x: ConfigSetting::new_default(None),
19251925
token_y: ConfigSetting::new_default(None),
@@ -1992,18 +1992,18 @@ impl SenderBuilder {
19921992
/// and [`token_y`](SenderBuilder::token_y).
19931993
///
19941994
/// For HTTP this is part of basic authentication.
1995-
/// Also see [`pass`](SenderBuilder::pass).
1996-
pub fn user(mut self, user: &str) -> Result<Self> {
1997-
self.user
1998-
.set_specified("user", Some(validate_value(user.to_string())?))?;
1995+
/// Also see [`password`](SenderBuilder::password).
1996+
pub fn username(mut self, username: &str) -> Result<Self> {
1997+
self.username
1998+
.set_specified("username", Some(validate_value(username.to_string())?))?;
19991999
Ok(self)
20002000
}
20012001

20022002
/// Set the password for basic HTTP authentication.
2003-
/// Also see [`user`](SenderBuilder::user).
2004-
pub fn pass(mut self, pass: &str) -> Result<Self> {
2005-
self.pass
2006-
.set_specified("pass", Some(validate_value(pass.to_string())?))?;
2003+
/// Also see [`username`](SenderBuilder::username).
2004+
pub fn password(mut self, password: &str) -> Result<Self> {
2005+
self.password
2006+
.set_specified("password", Some(validate_value(password.to_string())?))?;
20072007
Ok(self)
20082008
}
20092009

@@ -2295,56 +2295,56 @@ impl SenderBuilder {
22952295
fn build_auth(&self) -> Result<Option<AuthParams>> {
22962296
match (
22972297
self.protocol,
2298-
self.user.deref(),
2299-
self.pass.deref(),
2298+
self.username.deref(),
2299+
self.password.deref(),
23002300
self.token.deref(),
23012301
self.token_x.deref(),
23022302
self.token_y.deref(),
23032303
) {
23042304
(_, None, None, None, None, None) => Ok(None),
23052305
(
23062306
SenderProtocol::IlpOverTcp,
2307-
Some(user),
2307+
Some(username),
23082308
None,
23092309
Some(token),
23102310
Some(token_x),
23112311
Some(token_y),
23122312
) => Ok(Some(AuthParams::Ecdsa(EcdsaAuthParams {
2313-
key_id: user.to_string(),
2313+
key_id: username.to_string(),
23142314
priv_key: token.to_string(),
23152315
pub_key_x: token_x.to_string(),
23162316
pub_key_y: token_y.to_string(),
23172317
}))),
2318-
(SenderProtocol::IlpOverTcp, Some(_user), Some(_pass), None, None, None) => {
2318+
(SenderProtocol::IlpOverTcp, Some(_username), Some(_password), None, None, None) => {
23192319
Err(error::fmt!(ConfigError,
23202320
r##"The "basic_auth" setting can only be used with the ILP/HTTP protocol."##,
23212321
))
23222322
}
23232323
(SenderProtocol::IlpOverTcp, None, None, Some(_token), None, None) => {
23242324
Err(error::fmt!(ConfigError, "Token authentication only be used with the ILP/HTTP protocol."))
23252325
}
2326-
(SenderProtocol::IlpOverTcp, _user, None, _token, _token_x, _token_y) => {
2326+
(SenderProtocol::IlpOverTcp, _username, None, _token, _token_x, _token_y) => {
23272327
Err(error::fmt!(ConfigError,
2328-
r##"Incomplete ECDSA authentication parameters. Specify either all or none of: "user", "token", "token_x", "token_y"."##,
2328+
r##"Incomplete ECDSA authentication parameters. Specify either all or none of: "username", "token", "token_x", "token_y"."##,
23292329
))
23302330
}
23312331
#[cfg(feature = "ilp-over-http")]
2332-
(SenderProtocol::IlpOverHttp, Some(user), Some(pass), None, None, None) => {
2332+
(SenderProtocol::IlpOverHttp, Some(username), Some(password), None, None, None) => {
23332333
Ok(Some(AuthParams::Basic(BasicAuthParams {
2334-
username: user.to_string(),
2335-
password: pass.to_string(),
2334+
username: username.to_string(),
2335+
password: password.to_string(),
23362336
})))
23372337
}
23382338
#[cfg(feature = "ilp-over-http")]
2339-
(SenderProtocol::IlpOverHttp, Some(_user), None, None, None, None) => {
2339+
(SenderProtocol::IlpOverHttp, Some(_username), None, None, None, None) => {
23402340
Err(error::fmt!(ConfigError,
2341-
r##"Basic authentication parameter "user" is present, but "pass" is missing."##,
2341+
r##"Basic authentication parameter "username" is present, but "password" is missing."##,
23422342
))
23432343
}
23442344
#[cfg(feature = "ilp-over-http")]
2345-
(SenderProtocol::IlpOverHttp, None, Some(_pass), None, None, None) => {
2345+
(SenderProtocol::IlpOverHttp, None, Some(_password), None, None, None) => {
23462346
Err(error::fmt!(ConfigError,
2347-
r##"Basic authentication parameter "pass" is present, but "user" is missing."##,
2347+
r##"Basic authentication parameter "password" is present, but "username" is missing."##,
23482348
))
23492349
}
23502350
#[cfg(feature = "ilp-over-http")]
@@ -2356,7 +2356,7 @@ impl SenderBuilder {
23562356
#[cfg(feature = "ilp-over-http")]
23572357
(
23582358
SenderProtocol::IlpOverHttp,
2359-
Some(_user),
2359+
Some(_username),
23602360
None,
23612361
Some(_token),
23622362
Some(_token_x),
@@ -2365,14 +2365,14 @@ impl SenderBuilder {
23652365
Err(error::fmt!(ConfigError, "ECDSA authentication is only available with ILP/TCP and not available with ILP/HTTP."))
23662366
}
23672367
#[cfg(feature = "ilp-over-http")]
2368-
(SenderProtocol::IlpOverHttp, _user, _pass, _token, None, None) => {
2368+
(SenderProtocol::IlpOverHttp, _username, _password, _token, None, None) => {
23692369
Err(error::fmt!(ConfigError,
2370-
r##"Inconsistent HTTP authentication parameters. Specify either "user" and "pass", or just "token"."##,
2370+
r##"Inconsistent HTTP authentication parameters. Specify either "username" and "password", or just "token"."##,
23712371
))
23722372
}
23732373
_ => {
23742374
Err(error::fmt!(ConfigError,
2375-
r##"Incomplete authentication parameters. Check "user", "pass", "token", "token_x" and "token_y" parameters are set correctly."##,
2375+
r##"Incomplete authentication parameters. Check "username", "password", "token", "token_x" and "token_y" parameters are set correctly."##,
23762376
))
23772377
}
23782378
}
@@ -2634,7 +2634,7 @@ impl Sender {
26342634
///
26352635
/// The accepted set of keys and values is the same as for the opt's API.
26362636
///
2637-
/// E.g. `"http::addr=host:port;user=alice;password=secret;tls_ca=os_roots;"`.
2637+
/// E.g. `"http::addr=host:port;username=alice;password=secret;tls_ca=os_roots;"`.
26382638
///
26392639
/// For full list of keys and values, see the [`SenderBuilder`] documentation:
26402640
/// The builder API and the configuration string API are equivalent.

0 commit comments

Comments
 (0)