-
Notifications
You must be signed in to change notification settings - Fork 161
[ISSUE #795]📝Add doc for trait🎨 #796
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,25 +75,66 @@ impl RemoteClient { | |
} | ||
} | ||
|
||
/// `RemotingClient` trait extends `RemotingService` to provide client-specific remote interaction | ||
/// functionalities. | ||
/// | ||
/// This trait defines methods for managing name server addresses, invoking commands asynchronously | ||
/// or without expecting a response, checking if an address is reachable, and closing clients | ||
/// connected to specific addresses. | ||
#[allow(async_fn_in_trait)] | ||
pub trait RemotingClient: RemotingService { | ||
/// Updates the list of name server addresses. | ||
/// | ||
/// # Arguments | ||
/// * `addrs` - A list of name server addresses to update. | ||
fn update_name_server_address_list(&self, addrs: Vec<String>); | ||
|
||
/// Retrieves the current list of name server addresses. | ||
/// | ||
/// # Returns | ||
/// A vector containing the current list of name server addresses. | ||
fn get_name_server_address_list(&self) -> Vec<String>; | ||
|
||
/// Retrieves a list of available name server addresses. | ||
/// | ||
/// # Returns | ||
/// A vector containing the list of available name server addresses. | ||
fn get_available_name_srv_list(&self) -> Vec<String>; | ||
|
||
/// Asynchronously invokes a command on a specified address. | ||
/// | ||
/// # Arguments | ||
/// * `addr` - The address to invoke the command on. | ||
/// * `request` - The `RemotingCommand` to be sent. | ||
/// * `timeout_millis` - The timeout for the operation in milliseconds. | ||
/// | ||
/// # Returns | ||
/// A `Result` containing either the response `RemotingCommand` or an `Error`. | ||
Comment on lines
+104
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review async method The method |
||
async fn invoke_async( | ||
&self, | ||
addr: String, | ||
request: RemotingCommand, | ||
timeout_millis: u64, | ||
) -> Result<RemotingCommand, Error>; | ||
|
||
/// Invokes a command on a specified address without waiting for a response. | ||
/// | ||
/// # Arguments | ||
/// * `addr` - The address to invoke the command on. | ||
/// * `request` - The `RemotingCommand` to be sent. | ||
/// * `timeout_millis` - The timeout for the operation in milliseconds. | ||
async fn invoke_oneway(&self, addr: String, request: RemotingCommand, timeout_millis: u64); | ||
|
||
/// Checks if a specified address is reachable. | ||
/// | ||
/// # Arguments | ||
/// * `addr` - The address to check for reachability. | ||
fn is_address_reachable(&mut self, addr: String); | ||
|
||
/// Closes clients connected to the specified addresses. | ||
/// | ||
/// # Arguments | ||
/// * `addrs` - A list of addresses whose clients should be closed. | ||
Comment on lines
+128
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method The method fn close_clients(&mut self, addrs: Vec<String>) -> Result<(), Error>; |
||
fn close_clients(&mut self, addrs: Vec<String>); | ||
} | ||
|
||
|
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.
Consider improving error handling in
decode
.The
decode
method lacks detailed error handling documentation. It would be beneficial to specify the types of errors that could occur and how they should be handled.