westonpace opened a new issue, #7568:
URL: https://github.com/apache/arrow-rs/issues/7568

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   I have a synchronous method to encode an Array into a different format 
(Lance).  I would like to verify this method is not accidentally cloning (as in 
rust clone of buffer data, a shallow copy) any Arrow buffers as I don't want to 
extend the lifetime of the array.
   
   **Describe the solution you'd like**
   
   I would like there to be a `strong_count` method on `Buffer` which returns 
the strong count of `Buffer::data`.
   
   **Describe alternatives you've considered**
   
   Alternatively, this could just be called `ref_count` since there is no 
concept of a "weak buffer".  However, there could be such a concept in the 
future, and naming it `strong_count` has consistency with the equivalent method 
on `Arc`.
   
   Alternatively, we could provide an accessor for `data`, but the fact that 
one hasn't been provided before, suggests to me that we want to hide this 
detail.
   
   **Additional context**
   
   Playing devil's advocate, a counter argument could be made that we are 
introducing new complexity to the abstraction that has to be maintained (e.g. 
what if we don't use an `Arc` in the future).  However, the concept of a 
"reference count" seems inherent to the concept of a "cheaply cloneable buffer 
of data" so I think this is acceptable.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to