Make encoding functions public#322
Merged
chenyan-dfinity merged 3 commits intodfinity:masterfrom Mar 10, 2022
Merged
Conversation
Contributor
Author
|
@chenyan-dfinity, could you please take a look. |
Contributor
|
I'm a bit hesitated to make these public, as they are internal APIs and can change at any time. Probably better to add |
Contributor
Author
|
Done @chenyan-dfinity |
chenyan-dfinity
approved these changes
Mar 10, 2022
ninegua
pushed a commit
to ninegua/candid
that referenced
this pull request
Apr 22, 2022
Including LICENSE and a proper author/description/keywords. More could be added later but this fixes the requirements for open sourcing. Fixes dfinity#322 Co-authored-by: Kyle Peacock <kylpeacock@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Many APIs of candid encoding are private. This makes it harder to use this library in case of unusual scenarios implementation.
In one of my projects (ic-event-hub) I need to be able to transfer a (possibly very big) batch of objects between canisters in as few messages as possible, as efficiently as possible. I can achieve that using
ValueSerializerandTypeSerializestructs, filling messages with objects sequentially. But in order to do that, I'm using a customcandidfork where all methods of these structs are public.Here is the PR with some of these methods made public (enough to achieve what I want). But I strongly recommend the team managing this repo to choose more open policy in terms of method visibility and to make everything public. Yes, this will increase the risk of error making for beginners. But for experienced developers who understand the internals this is actually a lot more useful, because it allows them to program custom serialization logic on top of this library.
Considerations
This PR doesn't affect performance or security, but it could be useful to mark affected methods as
FOR ADVANCED USE ONLYin the docs.