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

RFC: take 2 on streams #249

Merged
merged 4 commits into from
Aug 1, 2024
Merged

RFC: take 2 on streams #249

merged 4 commits into from
Aug 1, 2024

Conversation

masad-frost
Copy link
Member

Got some comments on streams being complicated, so this is a take on simplified API.

  • Less methods and states that people need to understand
  • Merge interfaces into a single object (i.e. a stream call would have both read and write capabilities on the same object)

@masad-frost masad-frost requested a review from a team as a code owner July 31, 2024 00:17
@masad-frost masad-frost requested review from jackyzha0 and Monkatraz and removed request for a team July 31, 2024 00:17
Copy link
Member

@jackyzha0 jackyzha0 left a comment

Choose a reason for hiding this comment

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

many comments as requested but i like this a lot more than what we have

@@ -72,8 +73,7 @@ type UploadFn<
> = (
reqInit: ProcInit<Router, ProcName>,
options?: CallOptions,
) => {
reqWriter: WriteStream<ProcInput<Router, ProcName>>;
) => Writable<ProcInput<Router, ProcName>> & {
Copy link
Member

Choose a reason for hiding this comment

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

rename Router -> Service as a more accurate description

Copy link
Member Author

Choose a reason for hiding this comment

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

will fix in another PR when fixing the client.

router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
router/procedures.ts Outdated Show resolved Hide resolved
): Promise<Result<Static<ResponseData>, Static<ResponseErr>>>;
}

export class UploadProcedureHandlerParam<
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like the name of these classes is non-intuitive despite their verbosity - I feel like they could have plain names, like in this case something like UploadStream or HandlerUploadStream

Copy link
Member Author

Choose a reason for hiding this comment

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

How about UploadReadable? I'm trying to avoid using the term stream tbh, it's quite overloaded

router/streams2.ts Outdated Show resolved Hide resolved
router/streams2.ts Outdated Show resolved Hide resolved
@masad-frost
Copy link
Member Author

As much as I hate to merge into protocolv2 and leaving the branch non-functional/broken, I'm gonna go ahead an merge this to keep my PRs small and build on top of these abstractions without dealing with stacked branches too much.

@masad-frost masad-frost merged commit 667b6cb into protocolv2 Aug 1, 2024
0 of 2 checks passed
@masad-frost masad-frost deleted the fm-rfc-streams2 branch August 1, 2024 02:00
masad-frost added a commit that referenced this pull request Aug 1, 2024
## Why

Follow up on #249 to actually use the new interfaces. Removed extra
refactor done in #249 that merges the interfaces as that proved to be a
challenging API (un-yak-shave 🙅 🐃)

## What changed

- Removed close requests (mostly cherry-picked from #248)
- Otherwise a simple swapping out of the interfaces

## Versioning

- [ ] Breaking protocol change
- [ ] Breaking ts/js API change

<!-- Kind reminder to add tests and updated documentation if needed -->
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.

None yet

3 participants