Skip to content

specification: split attachment length into a separate field from attachment data #736

@wkalt

Description

@wkalt

Currently the Data field of attachment records is described as length-prefixed bytes. I think we should split it into two fields: Data size and Data.

This does not affect the layout of binary data, but would require a breaking change to SDKs. The reason for the change is supporting streaming writes of attachments. When writing an attachment from a stream, the length needs to be written prior to the stream body. It is not in general possible to know the length of a stream until the whole thing has been read (into the output file), which means backfilling the length would require a backwards seek.

Rather than relying on a seekable writer, we should have the data length supplied up-front in the attachment type supplied to WriteAttachment, and instead rely on the user to fetch it beforehand through some mechanism. For the typical case of attaching files read off disk this will be easy to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions