-
Notifications
You must be signed in to change notification settings - Fork 0
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
implement encoding flags and deep-doc encoding #33
Merged
Conversation
This file contains 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
- added a wireConfig type and EncodingOptions option function type - refactored NewPolorizer and Polorize functions to accept EncodingOptions - added the PackedBytes option that can be used to serialise bytes as a packed wire comprised of uint8 items instead of a singular word - refactored Polorizer.PolorizeBytes method to check the wire config for packed bytes status and serialize using the the polorizeByteAsPack method
- refactor NewDepolorizer to allow passing EncodingOptions - removed the NewPackDepolorizer constructor - added a method decodeBytesFromPack to decode a pack encoded uint values into an array of bytes
- refactored testObject into testSerialization that accepts EncodingOptions and tests the serialization consistency by applying the options at every step - added test cases for packed encoding of bytes in TestWord and TestSequence
- added new encoding options for enforcing doc encoding of structs and string maps respectively - added a new encoding options to accept a wireConfig to inherit, which can be used to pass on configurations to nested encoding buffers - added methods polorizeStructIntoDocument and polorizeStrMapIntoDocument to encode the appropriate types into Document objects - refactor polorizeMapValue and polorizeStructValue to check for config cases to encode documents - refactored document encoding test cases and examples - refactored DocumentEncode to PolorizeDocument only serializes the top level struct into a Document if compatible and it now accepts encoding options - refactor document.Set method to accept encoding options - refactored documentDecode function into a method of readbuffer called decodeDocument - refactor depolorizeMapValue and depolorizeStructValue methods to handle encoding config cases for document encoding
sarvalabs-rahul
approved these changes
Dec 12, 2023
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.
This PR significantly revamps the document encoding/decoding implementations to support deep document encoding as well as enables the ability to use encoding options flags when using automatic serialization and deserialization functions.
Polorize
andDepolorize
functions as well as theNewPolorizer
andNewDepolorizer
constructors now accept a variadic set ofEncodingOptions
to alter buffer behavior.DocumentEncode
function has been replaced byPolorizeDocument
which only performs shallow doc encoding on the highest order type (if supported). Deep document encoding will require buffer altering flags to the regularPolorize
functionNewPackPolorizer
function has been removed.readbuffer
has new methodsdecodeBytesFromPack
anddecodeDocument
(replaces thedocumentEncode
function)wireConfig
type and a private encoding optioninheritCfg
enable the new encoding flags mechanic.The currently available
EncodingOption
functions are as follows:DocStructs
: Encode all structs encountered with document encodingDocStringMaps
: Encode all string-keyed maps encountered with document encodingPackedBytes
: Encode all[]byte
typed values with pack-encoding instead of word-encoding (increases wire size)