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

feat: use libp2p component logger #66

Closed
wants to merge 2 commits into from

Conversation

achingbrain
Copy link
Collaborator

Refactors code to use the component logger from libp2p to allow more flexible logging patterns.

Refs: https://github.com/libp2p/js-libp2p/issue/2105
Refs: libp2p/js-libp2p#2198
Refs: https://github.com/libp2p/js-libp2p/issue/378

The general pattern of stream muxers is to yield protocol stream data
framed by some additional metadata - stream id, flags, etc.

The frame data can be prepended/appended to the protocol stream data
by using a `Uint8ArrayList` instead of a `Uint8Array`, this removes the
need to copy the protocol data into a new `Uint8Array` for every frame.

The new `@libp2p/interface` version allows muxers to emit
`Uint8ArrayList`s as well as `Uint8Array`s so we can send protocol
stream data to a transport in a no-copy operation.
@achingbrain
Copy link
Collaborator Author

#65 should be merged into master first, then this PR retargeted to master.

@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (8495ae3) 95.61% compared to head (00e3cb6) 95.52%.

Files Patch % Lines
src/muxer.ts 90.90% 2 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                            @@
##           feat/support-yielding-uint8arraylists      #66      +/-   ##
=========================================================================
- Coverage                                  95.61%   95.52%   -0.09%     
=========================================================================
  Files                                         14       14              
  Lines                                       2210     2211       +1     
  Branches                                     329      329              
=========================================================================
- Hits                                        2113     2112       -1     
- Misses                                        97       99       +2     
Flag Coverage Δ
node 95.52% <92.85%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Refactors code to use the component logger from libp2p to allow
more flexible logging patterns.

Refs: https://github.com/libp2p/js-libp2p/issue/2105
Refs: libp2p/js-libp2p#2198
Refs: https://github.com/libp2p/js-libp2p/issue/378
@achingbrain achingbrain force-pushed the feat/use-libp2p-component-logger branch from 44ec1ad to 00e3cb6 Compare November 26, 2023 08:48
@achingbrain achingbrain force-pushed the feat/support-yielding-uint8arraylists branch from 8495ae3 to 9a48fd3 Compare November 29, 2023 14:30
Base automatically changed from feat/support-yielding-uint8arraylists to master November 29, 2023 14:47
@achingbrain
Copy link
Collaborator Author

Fixed in #65

@achingbrain achingbrain deleted the feat/use-libp2p-component-logger branch November 29, 2023 15:11
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