Skip to content

Conversation

@Shreyas220
Copy link
Contributor

@Shreyas220 Shreyas220 commented Jan 12, 2026

for #589

  • Added PuffinWriter
  • Added PuffinReader
  • uncompressed only

Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
@Shreyas220
Copy link
Contributor Author

Shreyas220 commented Jan 12, 2026

Hey 👋 @zeroshade , @twuebi would appreciate a review
tests coming next

@Shreyas220 Shreyas220 marked this pull request as ready for review January 12, 2026 22:54
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting this up! I've been wanting to get a puffin reader/writer in here for a while now. I've gone through with a bunch of questions / requests etc. But this also needs to have some tests and potentially examples if possible!

Thanks again!


// SetProperties merges the provided properties into the file-level properties
// written to the footer. Can be called multiple times before Finish.
func (w *PuffinWriter) SetProperties(props map[string]string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have a way to remove properties also? Or a way to clear the current properties?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is cumulative, maybe it should be renamed as "AddProperties" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ClearProperties() method .
is there a requirement for removing a specific property ?

Comment on lines 171 to 181
// Read footer JSON payload
payload := make([]byte, payloadSize)
if _, err := r.r.ReadAt(payload, footerStart+MagicSize); err != nil {
return nil, fmt.Errorf("puffin: read footer payload: %w", err)
}

// Parse footer JSON
var footer Footer
if err := json.Unmarshal(payload, &footer); err != nil {
return nil, fmt.Errorf("puffin: decode footer JSON: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to copy the bytes, use a io.LimitedReader and a json.Decoder and just decode directly from the reader instead. Given that JSON can be large, avoiding the copy before we unmarshal could be a potential significant savings

Comment on lines 314 to 316
// ReadRange reads a raw byte range from the blob data region.
// The footer must be read first to establish bounds checking.
func (r *PuffinReader) ReadRange(offset, length int64) ([]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the actual use of this function? When would a user want to use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletion vector in manifests include offset and length into Puffin file. can directly read that range

Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
Signed-off-by: Shreyas220 <shreyas.ny@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants