deps: update it-length-prefix, uint8arraylist etc (#1317)

In order to support no-copy operations in streams, update all deps
to support streaming Uint8ArrayLists.
This commit is contained in:
Alex Potsides
2022-08-03 14:15:35 +01:00
committed by GitHub
parent 05e8e7ead9
commit 564f4b8aa7
27 changed files with 69 additions and 58 deletions

View File

@ -10,6 +10,7 @@ import type { Libp2pInit, Libp2pOptions } from '../../src/index.js'
import type { PeerId } from '@libp2p/interface-peer-id'
import * as cborg from 'cborg'
import { peerIdFromString } from '@libp2p/peer-id'
import { Uint8ArrayList } from 'uint8arraylist'
const relayAddr = MULTIADDRS_WEBSOCKETS[0]
@ -32,16 +33,16 @@ class MockPubSub extends PubSubBaseProtocol {
return cborg.decode(bytes)
}
encodeRpc (rpc: PubSubRPC): Uint8Array {
return cborg.encode(rpc)
encodeRpc (rpc: PubSubRPC): Uint8ArrayList {
return new Uint8ArrayList(cborg.encode(rpc))
}
decodeMessage (bytes: Uint8Array): PubSubRPCMessage {
return cborg.decode(bytes)
}
encodeMessage (rpc: PubSubRPCMessage): Uint8Array {
return cborg.encode(rpc)
encodeMessage (rpc: PubSubRPCMessage): Uint8ArrayList {
return new Uint8ArrayList(cborg.encode(rpc))
}
async publishMessage (from: PeerId, message: Message): Promise<PublishResult> {