@@ -4,46 +4,52 @@ use std::borrow::Cow;
44/// to be sent in STARTUP message.
55#[ derive( Debug , Clone , Default ) ]
66pub struct SelfIdentity < ' id > {
7- // Custom driver identity can be set if a custom driver build is running,
8- // or an entirely different driver is operating on top of Rust driver
9- // (e.g. cpp-rust-driver).
7+ /// Custom driver identity can be set if a custom driver build is running,
8+ /// or an entirely different driver is operating on top of Rust driver
9+ /// (e.g. cpp-rust-driver).
1010 custom_driver_name : Option < Cow < ' id , str > > ,
11+ /// Custom driver identity can be set if a custom driver build is running,
12+ /// or an entirely different driver is operating on top of Rust driver
13+ /// (e.g. cpp-rust-driver).
1114 custom_driver_version : Option < Cow < ' id , str > > ,
1215
1316 // ### Q: Where do APPLICATION_NAME, APPLICATION_VERSION and CLIENT_ID come from?
1417 // - there are no columns in system.clients dedicated to those attributes,
1518 // - APPLICATION_NAME / APPLICATION_VERSION are not present in Scylla's source code at all,
1619 // - only 2 results in Cassandra source is some example in docs:
17- // https://github.com/apache/cassandra/blob/d3cbf9c1f72057d2a5da9df8ed567d20cd272931/doc/modules/cassandra/pages/managing/operating/virtualtables.adoc?plain=1#L218.
20+ // < https://github.com/apache/cassandra/blob/d3cbf9c1f72057d2a5da9df8ed567d20cd272931/doc/modules/cassandra/pages/managing/operating/virtualtables.adoc?plain=1#L218> .
1821 // APPLICATION_NAME and APPLICATION_VERSION appears in client_options which
1922 // is an arbitrary dict where client can send any keys.
2023 // - driver variables are mentioned in protocol v5
21- // (https://github.com/apache/cassandra/blob/d3cbf9c1f72057d2a5da9df8ed567d20cd272931/doc/native_protocol_v5.spec#L480),
24+ // (< https://github.com/apache/cassandra/blob/d3cbf9c1f72057d2a5da9df8ed567d20cd272931/doc/native_protocol_v5.spec#L480> ),
2225 // application variables are not.
2326 //
2427 // ### A:
2528 // The following options are not exposed anywhere in ScyllaDB tables.
2629 // They come directly from CPP driver, and they are supported in Cassandra
2730 //
28- // See https://github.com/scylladb/cpp-driver/blob/fa0f27069a625057984d1fa58f434ea99b86c83f/include/cassandra.h#L2916.
31+ // See < https://github.com/scylladb/cpp-driver/blob/fa0f27069a625057984d1fa58f434ea99b86c83f/include/cassandra.h#L2916> .
2932 // As we want to support as big subset of its API as possible in cpp-rust-driver, I decided to expose API for setting
3033 // those particular key-value pairs, similarly to what cpp-driver does, and not an API to set arbitrary key-value pairs.
3134 //
3235 // Allowing users to set arbitrary options could break the driver by overwriting options that bear special meaning,
3336 // e.g. the shard-aware port. Therefore, I'm against such liberal API. OTOH, we need to expose APPLICATION_NAME,
3437 // APPLICATION_VERSION and CLIENT_ID for cpp-rust-driver.
35-
36- // Application identity can be set to distinguish different applications
37- // connected to the same cluster.
38+ /// Application identity can be set to distinguish different applications
39+ /// connected to the same cluster.
3840 application_name : Option < Cow < ' id , str > > ,
41+ /// Application identity can be set to distinguish different applications
42+ /// connected to the same cluster.
3943 application_version : Option < Cow < ' id , str > > ,
4044
41- // A (unique) client ID can be set to distinguish different instances
42- // of the same application connected to the same cluster.
45+ /// A (unique) client ID can be set to distinguish different instances
46+ /// of the same application connected to the same cluster.
4347 client_id : Option < Cow < ' id , str > > ,
4448}
4549
4650impl < ' id > SelfIdentity < ' id > {
51+ /// Creates a new empty instance of [`SelfIdentity`], which has all fields
52+ /// set to `None`.
4753 pub fn new ( ) -> Self {
4854 Self :: default ( )
4955 }
0 commit comments