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

add an EncodeWriter method, using the pooled marshallers #102

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

MichaelMure
Copy link
Contributor

This PR add an EncodeWriter method, to skip an allocation and copy, while still using the pooled marshallers.

Copy link

welcome bot commented Sep 18, 2024

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@MichaelMure
Copy link
Contributor Author

Beyond that, I'd like to suggest the following to address the // TODO: rename` and the inconsistent naming:

// DumpObject marshals any object into its CBOR serialized byte representation
// Deprecated: user Encode instead.
func DumpObject(obj interface{}) (out []byte, err error) {
	return marshaller.Marshal(obj)
}

// Encode marshals any object into its CBOR serialized byte representation
func Encode(obj interface{}) (out []byte, err error) {
	return marshaller.Marshal(obj)
}

I can add it in this PR or make another one if you find that suitable.

@rvagg
Copy link
Member

rvagg commented Sep 24, 2024

👍 you're welcome to do the deprecation too and we can cut a new release; it'll be painful for anyone running strict linting tho

@rvagg rvagg merged commit 2e94acd into ipfs:master Sep 24, 2024
9 checks passed
@MichaelMure MichaelMure deleted the encode-writer branch October 1, 2024 09:35
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