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

fix!: make stream types Uint8ArrayLists #272

Merged
merged 1 commit into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/interface-pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
"@libp2p/interface-connection": "^2.0.0",
"@libp2p/interface-peer-id": "^1.0.0",
"@libp2p/interfaces": "^3.0.0",
"it-pushable": "^3.0.0"
"it-pushable": "^3.0.0",
"uint8arraylist": "^2.0.0"
},
"devDependencies": {
"aegir": "^37.4.0"
Expand Down
11 changes: 6 additions & 5 deletions packages/interface-pubsub/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { PeerId } from '@libp2p/interface-peer-id'
import type { Pushable } from 'it-pushable'
import type { EventEmitter } from '@libp2p/interfaces/events'
import type { Stream } from '@libp2p/interface-connection'
import type { Uint8ArrayList } from 'uint8arraylist'

/**
* On the producing side:
Expand Down Expand Up @@ -58,14 +59,14 @@ export interface PubSubRPC {
export interface PeerStreams extends EventEmitter<PeerStreamEvents> {
id: PeerId
protocol: string
outboundStream?: Pushable<Uint8Array>
inboundStream?: AsyncIterable<Uint8Array>
outboundStream?: Pushable<Uint8ArrayList>
inboundStream?: AsyncIterable<Uint8ArrayList>
isWritable: boolean

close: () => void
write: (buf: Uint8Array) => void
attachInboundStream: (stream: Stream) => AsyncIterable<Uint8Array>
attachOutboundStream: (stream: Stream) => Promise<Pushable<Uint8Array>>
write: (buf: Uint8Array | Uint8ArrayList) => void
attachInboundStream: (stream: Stream) => AsyncIterable<Uint8ArrayList>
attachOutboundStream: (stream: Stream) => Promise<Pushable<Uint8ArrayList>>
}

export interface PubSubInit {
Expand Down