-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the session and pool. #10
Add the session and pool. #10
Conversation
nebula_rust/examples/basic_op.rs
Outdated
let resp = session.execute("YIELD 1").await.unwrap(); | ||
assert!(resp.error_code == common::types::ErrorCode::SUCCEEDED); | ||
|
||
println!("{:?}", resp.data.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add code to read the table value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
if self.conns.lock().unwrap().borrow_mut().is_empty() { | ||
self.new_connection(1).await; | ||
} | ||
let conn = self.conns.lock().unwrap().borrow_mut().pop_back(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the connection pop from the list, and if the user does no return it, the pool couldn't close it. You need to make the pool can manage it when the use get it from the pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to make the connection is ok, here you can get a bad connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pool can't access the connection owned by session. It's designed to avoid some data race
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keep-alive will add in later pr.
|
||
/// sign out the session | ||
#[inline] | ||
pub async fn signout(&self) -> std::result::Result<(), common::types::ErrorCode> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modify the function name to release
,
and the release function needs to return the connection to pool too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This had done in the drop method.
* attached with Common Clause Condition 1.0, found in the LICENSES directory. | ||
*/ | ||
|
||
pub trait DataSet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ExcutionResponse wrapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's data set extension not related to the response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.