Skip to content

Commit d3be384

Browse files
committed
Fix linting
1 parent 4b39929 commit d3be384

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed

src/testing.cpp

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,44 @@ String get_host_from_future(CassFuture* future) {
4747
}
4848

4949
StringVec get_attempted_hosts_from_future(CassFuture* future) {
50-
// Original implementation commented out for reference.
51-
/*
52-
if (future->type() != Future::FUTURE_TYPE_RESPONSE) {
53-
return StringVec();
54-
}
50+
// Original implementation commented out for reference.
51+
/*
52+
if (future->type() != Future::FUTURE_TYPE_RESPONSE) {
53+
return StringVec();
54+
}
5555
56-
StringVec attempted_hosts;
57-
ResponseFuture* response_future = static_cast<ResponseFuture*>(future->from());
56+
StringVec attempted_hosts;
57+
ResponseFuture* response_future = static_cast<ResponseFuture*>(future->from());
5858
59-
AddressVec attempted_addresses = response_future->attempted_addresses();
60-
for (const auto& address : attempted_addresses) {
61-
attempted_hosts.push_back(address.to_string());
62-
}
63-
std::sort(attempted_hosts.begin(), attempted_hosts.end());
64-
return attempted_hosts;
65-
*/
66-
67-
StringVec attempted_hosts;
68-
69-
char* const concatenated_attempted_addresses = testing_future_get_attempted_hosts(future);
70-
71-
std::string concatenated_addresses = concatenated_attempted_addresses;
72-
std::stringstream stream{concatenated_addresses};
73-
while (true) {
74-
String address;
75-
if (std::getline(stream, address, '\n')) {
76-
if (!address.empty()) {
77-
attempted_hosts.push_back(address);
78-
}
79-
} else {
80-
break; // No more addresses to read.
81-
}
59+
AddressVec attempted_addresses = response_future->attempted_addresses();
60+
for (const auto& address : attempted_addresses) {
61+
attempted_hosts.push_back(address.to_string());
62+
}
63+
std::sort(attempted_hosts.begin(), attempted_hosts.end());
64+
return attempted_hosts;
65+
*/
66+
67+
StringVec attempted_hosts;
68+
69+
char* const concatenated_attempted_addresses = testing_future_get_attempted_hosts(future);
70+
71+
std::string concatenated_addresses = concatenated_attempted_addresses;
72+
std::stringstream stream{ concatenated_addresses };
73+
while (true) {
74+
String address;
75+
if (std::getline(stream, address, '\n')) {
76+
if (!address.empty()) {
77+
attempted_hosts.push_back(address);
78+
}
79+
} else {
80+
break; // No more addresses to read.
8281
}
83-
std::sort(attempted_hosts.begin(), attempted_hosts.end());
82+
}
83+
std::sort(attempted_hosts.begin(), attempted_hosts.end());
8484

85-
testing_free_cstring(concatenated_attempted_addresses);
85+
testing_free_cstring(concatenated_attempted_addresses);
8686

87-
return attempted_hosts;
87+
return attempted_hosts;
8888
}
8989

9090
unsigned get_connect_timeout_from_cluster(CassCluster* cluster) {
@@ -143,7 +143,7 @@ String get_server_name(CassFuture* future) {
143143
}
144144

145145
void set_record_attempted_hosts(CassStatement* statement, bool enable) {
146-
testing_statement_set_recording_history_listener(statement, (cass_bool_t) enable);
146+
testing_statement_set_recording_history_listener(statement, (cass_bool_t)enable);
147147
}
148148

149149
void set_sleeping_history_listener_on_statement(CassStatement* statement, uint64_t sleep_time_ms) {
@@ -154,8 +154,6 @@ void set_sleeping_history_listener_on_batch(CassBatch* batch, uint64_t sleep_tim
154154
testing_batch_set_sleeping_history_listener(batch, sleep_time_ms);
155155
}
156156

157-
CassRetryPolicy* retry_policy_ignoring_new() {
158-
return testing_retry_policy_ignoring_new();
159-
}
157+
CassRetryPolicy* retry_policy_ignoring_new() { return testing_retry_policy_ignoring_new(); }
160158

161159
}}} // namespace datastax::internal::testing

src/testing.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ CASS_EXPORT String get_server_name(CassFuture* future);
5050

5151
CASS_EXPORT void set_record_attempted_hosts(CassStatement* statement, bool enable);
5252

53-
CASS_EXPORT void set_sleeping_history_listener_on_statement(CassStatement* statement, uint64_t sleep_time_ms);
53+
CASS_EXPORT void set_sleeping_history_listener_on_statement(CassStatement* statement,
54+
uint64_t sleep_time_ms);
5455

5556
CASS_EXPORT void set_sleeping_history_listener_on_batch(CassBatch* batch, uint64_t sleep_time_ms);
5657

src/testing_rust_impls.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,34 @@ CASS_EXPORT void testing_cluster_get_contact_points(CassCluster* cluster, char**
2525
// This method fails if the future resolved to some error.
2626
//
2727
// On success, it allocates a host string which needs to be then freed wih `testing_free_cstring`.
28-
CASS_EXPORT void testing_future_get_host(const CassFuture* future, char** host, size_t* host_length);
28+
CASS_EXPORT void testing_future_get_host(const CassFuture* future, char** host,
29+
size_t* host_length);
2930

30-
CASS_EXPORT void testing_free_cstring(char *s);
31+
CASS_EXPORT void testing_free_cstring(char* s);
3132

3233
// Sets a sleeping history listener on the statement.
3334
// This can be used to enforce a sleep time during statement execution, which increases the latency.
34-
CASS_EXPORT void testing_statement_set_sleeping_history_listener(CassStatement *statement,
35+
CASS_EXPORT void testing_statement_set_sleeping_history_listener(CassStatement* statement,
3536
cass_uint64_t sleep_time_ms);
3637

3738
// Sets a sleeping history listener on the batch.
3839
// This can be used to enforce a sleep time during batch execution, which increases the latency.
39-
CASS_EXPORT void testing_batch_set_sleeping_history_listener(CassBatch *batch,
40-
cass_uint64_t sleep_time_ms);
40+
CASS_EXPORT void testing_batch_set_sleeping_history_listener(CassBatch* batch,
41+
cass_uint64_t sleep_time_ms);
4142
}
4243

4344
// Sets a recording history listener on the statement.
4445
// This can be used to collect addresses of hosts attempted during statement execution.
4546
// Those can be later retrieved using `testing_future_get_attempted_hosts`.
46-
CASS_EXPORT void testing_statement_set_recording_history_listener(CassStatement *statement,
47-
cass_bool_t enable);
47+
CASS_EXPORT void testing_statement_set_recording_history_listener(CassStatement* statement,
48+
cass_bool_t enable);
4849

4950
// Retrieves a concatenated string of attempted hosts from the future.
5051
// Hosts are delimited with '\n' character.
5152
// Hosts are recorded only if `testing_statement_set_recording_history_listener`
5253
// was called on the statement previously.
5354
// The returned pointer is allocated and must be freed with `testing_free_cstring`.
54-
CASS_EXPORT char* testing_future_get_attempted_hosts(CassFuture *future);
55+
CASS_EXPORT char* testing_future_get_attempted_hosts(CassFuture* future);
5556

5657
/**
5758
* Creates a new ignoring retry policy.

0 commit comments

Comments
 (0)