Skip to content

docs(lp32): Elaborate README - #3044

Merged
kriskowal merged 1 commit into
masterfrom
kriskowal-docs-lp32
Jan 29, 2026
Merged

docs(lp32): Elaborate README#3044
kriskowal merged 1 commit into
masterfrom
kriskowal-docs-lp32

Conversation

@kriskowal

Copy link
Copy Markdown
Member

This change documents the lp32 package. It also addresses some minor inconsistencies in the implementation. The byte order for native messages is not configurable.

@erights erights left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Comment thread packages/lp32/README.md
Comment thread packages/lp32/reader.js
Comment thread packages/lp32/README.md
});

const encoder = new TextEncoder();
await writer.next(encoder.encode('hello'));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good that we no longer need to seed the generator push-side protocol with a bogus first call to next().

Noting that @ljharb is about to withdraw function.sent, pending approval from @hax, so we could never repair this anyway if writer were a generator`.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, using the iterator protocol directly, we don’t suffer the parity mismatch of generators. This comes up in the draft exo-stream change as well.

Comment thread packages/lp32/README.md

const reader = makeLp32Reader(byteStream, {
name: '<my-stream>', // optional, for error messages
maxMessageLength: 1024 * 1024, // optional, defaults to 1MB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the max is exceeded?

Comment thread packages/lp32/README.md
Comment on lines +80 to +83
// Producer
await writer.next(encoder.encode('message 1'));
await writer.next(encoder.encode('message 2'));
await writer.return();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these awaits for flow control? I notice there is an initialCapacity and a maxMessageLength but no maxCapacity. So what does the flow control wait for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The awaits are for flow control. The reader must call next for the producer to advance. There’s a facility in @endo/stream for pre-acking so that these pipeline within pre-arranged bounds, but the default is that they’re synchronized.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "but the default is that they’re synchronized." do you mean there is effectively a zero-sized buffer, i.e., that this is a rendezvous protocol by default? This question should not delay merging, especially since this PR only documents the status quo. But I would like to discuss sometime. Low priority compared to everything else going on right now though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the default is effectively a zero-sized buffer.

@kriskowal
kriskowal force-pushed the kriskowal-docs-lp32 branch from 292dc63 to 6f7547c Compare January 29, 2026 02:56
@kriskowal
kriskowal enabled auto-merge January 29, 2026 02:56
@kriskowal
kriskowal merged commit a463007 into master Jan 29, 2026
21 checks passed
@kriskowal
kriskowal deleted the kriskowal-docs-lp32 branch January 29, 2026 03:02
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