Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wkalt opened this issue Nov 20, 2022 · 0 comments
Labels
feature New feature or request

Comments

@wkalt
Copy link
Contributor

wkalt commented Nov 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Development

No branches or pull requests

1 participant