Skip to content

Use 'static lifetime for delete_stream #518

Description

@linhr

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Right now the ObjectStore::delete_stream method requires the input stream to have a lifetime 'a. This restriction makes it more challenging for implementers. For example, in my project, I have a ObjectStore wrapper that needs to spawn tasks for the operation, but since the input is 'a, I cannot move the input to the future due to Rust's lifetime checker.

It seems delete_stream is the only method that requires the 'a lifetime. Other methods have been changed to use 'static streams (apache/arrow-rs#6619) already, so this may be a leftover due to historical reasons.

Describe the solution you'd like

I'd imagine the delete_stream method to be changed to the following.

    fn delete_stream(
        &self,
        locations: BoxStream<'static, Result<Path>>,
    ) -> BoxStream<'static, Result<Path>> {

This is a breaking change on the interface, so all the implementations need to be adjusted accordingly. Fortunately, the method won't become harder to implement since this is a restriction on the input so it refines the problem space for the implementer.

For users, this breaking change won't be too disruptive either, since the typical use case is to get the stream from list or list_with_offset (where the returned stream is of 'static lifetime already), and then pass the stream to delete_stream.

Since this would be a breaking change, I wonder if this could be considered for the 0.13 release (#367).

Describe alternatives you've considered

N/A

Additional context

There was a more general discussion on this topic: apache/arrow-rs#6587

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions