Skip to content

proposal: os: support copy_file_range for SectionReader #73399

@hanwen-flow

Description

@hanwen-flow

Proposal Details

Writing to a file from an io.SectionReader backed by a file could
use copy_file_range(2).

The machinery for this mostly exists: SectionReader.Outer() gives
access to the underlying *os.File and offset. Then, the offset
should be passed into unix.CopyFileRange. After the call completes,
the number of bytes (or the updated offset) can be passed to
SectionReader.Seek.

The only missing piece is that CopyFileRange in internal/poll
does not accept offset arguments. Is this something that can be
changed, and if yes, does it require a formal proposal?

For reference, this is similar to
#61727.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions