Skip to content

Conversation

@cholcombe973
Copy link
Contributor

@cholcombe973 cholcombe973 commented Jan 9, 2019

Warning! Many breaking changes here from clippy suggestions about best practices.

Copy link
Collaborator

@ChrisMacNaughton ChrisMacNaughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm generally happy with passing pointers instead of moving values, I'd like to understand the reasoning for these type changes, as well as the additional changes of pointer -> move


/// Update tmap (trivial map)
pub fn rados_object_tmap_update(&self, object_name: &str, update: TmapOperation) -> RadosResult<()> {
pub fn rados_object_tmap_update(&self, object_name: &str, update: &TmapOperation) -> RadosResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?


// Perform a compound read operation synchronously
pub fn rados_perform_read_operations(&self, read_op: ReadOperation) -> RadosResult<()> {
pub fn rados_perform_read_operations(&self, read_op: &ReadOperation) -> RadosResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?

value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?

value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?

value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?

}

pub fn run_command(&self, command: MonCommand) -> Result<String, RadosError> {
pub fn run_command(&self, command: &MonCommand) -> Result<String, RadosError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to change from pass by value to a pointer?


/// Query a ceph pool.
pub fn osd_pool_get(cluster_handle: &Rados, pool: &str, choice: &PoolOption) -> RadosResult<String> {
pub fn osd_pool_get(cluster_handle: &Rados, pool: &str, choice: PoolOption) -> RadosResult<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the (many) comments about moves vs pointers, the ones in this file are the reverse?

Also fix some double pointers and use rados_buffer_free for
ceph heap allocated memory. Prevent mem leaks
@cholcombe973
Copy link
Contributor Author

Yeah all of these changes are clippy suggestions that values weren't consumed by a function so they should be passed by reference or that enum's passed by reference would be more efficient if they were copied. I don't know how true the copy efficiency is because i haven't benchmarked it.

@Xuanwo Xuanwo force-pushed the master branch 2 times, most recently from ead7751 to 9b39b74 Compare September 3, 2024 13:14
@Xuanwo
Copy link
Collaborator

Xuanwo commented Sep 3, 2024

Hi, @cholcombe973, would you be interested in working on this again?

@cholcombe973
Copy link
Contributor Author

cholcombe973 commented Sep 3, 2024 via email

@Xuanwo
Copy link
Collaborator

Xuanwo commented Sep 3, 2024

Yeah I could try a rebase and clippy again to see what happens.

Perfect, thank you so much! I'm so happy you're still here, in this community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants