Skip to content

api: unexport Stream fields, add Id() accessor#588

Open
bigbes wants to merge 1 commit intomasterfrom
bigbes/gh-471-unexport-stream-fields
Open

api: unexport Stream fields, add Id() accessor#588
bigbes wants to merge 1 commit intomasterfrom
bigbes/gh-471-unexport-stream-fields

Conversation

@bigbes
Copy link
Copy Markdown
Collaborator

@bigbes bigbes commented May 5, 2026

  • Unexports Stream.Id and Stream.Conn (v3 breaking change) to enforce encapsulation and prevent unsafe direct mutation like stream.Conn = nil.
  • Adds Stream.Id() uint64 accessor; the underlying connection is no longer reachable from outside the package.

Closes #471

Make Stream.Id and Stream.Conn unexported to enforce encapsulation
and prevent unsafe direct mutation. The stream identifier is now
exposed via a Stream.Id() method; the underlying connection is no
longer reachable from outside the package — callers should hold
their own *Connection reference if they need it.

- Rename Stream.Id to Stream.id, add Stream.Id() accessor.
- Rename Stream.Conn to Stream.conn, drop public access.
- Add SetStreamIdForTesting helper in export_test.go so external
  tests can still exercise wire-encoding for arbitrary stream ids.
- Document the breaking change in CHANGELOG.md and MIGRATION.md.

Closes #471
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.

v3: refactor Stream struct

1 participant