Repository navigation
Conversation
Author
|
hi @amisol @kranthipoturaju @apsivam |
Member
|
Hello, thanks for the contribution. We’ve intentionally kept I/O outside this library to keep its scope small and focused. Applications can combine the existing encoding and decoding functions with their own I/O and error handling. Reader/writer helpers introduce additional decisions around partial reads and writes, error propagation, and recovery. We feel those decisions are better handled by the implementing applications. |
Author
|
@madflojo so do i close this repository ? also , is there any issue or task i can work upon this repository as this would be really helpful for my practical learning ? |
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.
Description
This PR adds two new public functions to enable streaming/IO-based MLI encoding and decoding, making the library more suitable for real-world TCP socket implementations where data is read/written incrementally.
Changes
EncodeWriter(w io.Writer, key string, length int) error- Encodes the MLI for the given key and length, writing directly to anio.WriterDecodeReader(r io.Reader, key string) (int, error)- Reads the MLI bytes from anio.Readerand returns the decoded message lengthmliSize(key string) intfor internal size lookupioimportMotivation
The existing
Encode/DecodeAPI requires the full MLI byte slice upfront, which doesn't align well with streaming protocols like TCP where data arrives incrementally.These new functions allow users to:
Example Usage
Testing
bytes.Bufferfor all 7 MLI typesgo test -race ./...Backward Compatibility
✅ Fully backward compatible - no existing APIs modified, only new functions added
Checklist
go test -race ./...)go build ./...)go vet ./...)gofmt -l .)