Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

chore: add duplex iterable type to connection #71

Closed

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Nov 25, 2020

This PR adds the duplex iterable type to connection per libp2p/js-libp2p#802 (comment)

This already existed in the pubsub peer streams and it was moved into the conenction and linked from there

cc @wemeetagain (could not ask you direct review)

@vasco-santos vasco-santos marked this pull request as draft November 25, 2020 16:38
@vasco-santos vasco-santos force-pushed the chore/add-duplex-iterable-type-to-connection branch from 88f32fd to 91289ba Compare November 25, 2020 16:40
@vasco-santos vasco-santos force-pushed the chore/add-duplex-iterable-type-to-connection branch from 91289ba to be84a4b Compare November 25, 2020 16:42
@vasco-santos vasco-santos marked this pull request as ready for review November 25, 2020 16:59
export type DuplexIterableStream = {
sink: Sink;
source: () => AsyncIterator<Uint8Array, any, undefined>;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

The type here should really just be a Stream, and it should match what's coming from mplex https://github.com/libp2p/js-libp2p-mplex/blob/v0.10.1/src/stream.js#L59

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we add the Stream in a type declaration file in the multiplexer interface?

*
* @typedef {object} DuplexIterableStream
* @property {Sink} sink
* @property {() AsyncIterator<Uint8Array>} source
Copy link

Choose a reason for hiding this comment

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

Is this AsyncIterator or is it meant to be AsyncIterable ?

@vasco-santos
Copy link
Member Author

Closed in favour of #74

@vasco-santos vasco-santos deleted the chore/add-duplex-iterable-type-to-connection branch December 1, 2020 22:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants