import { TypedEventEmitter } from '@libp2p/interface'; import type { AbstractStream } from './abstract-stream.ts'; import type { AbortOptions, CounterGroup, CreateStreamOptions, EventHandler, Logger, MessageStream, StreamMuxer, StreamMuxerEvents, StreamMuxerOptions, StreamMuxerStatus, StreamOptions } from '@libp2p/interface'; import type { Uint8ArrayList } from 'uint8arraylist'; export interface AbstractStreamMuxerInit extends StreamMuxerOptions { /** * The protocol name for the muxer */ protocol: string; /** * The name of the muxer, used to create a new logging scope from the passed * connection's logger */ name: string; /** * A counter for muxer metrics */ metrics?: CounterGroup; } export declare abstract class AbstractStreamMuxer extends TypedEventEmitter> implements StreamMuxer { streams: MuxedStream[]; protocol: string; status: StreamMuxerStatus; protected log: Logger; protected maConn: MessageStream; protected streamOptions?: StreamOptions; protected earlyStreams: MuxedStream[]; protected maxEarlyStreams: number; private readonly metrics?; constructor(maConn: MessageStream, init: AbstractStreamMuxerInit); send(data: Uint8Array | Uint8ArrayList): boolean; close(options?: AbortOptions): Promise; abort(err: Error): void; onTransportClosed(err?: Error): void; createStream(options?: CreateStreamOptions): Promise; /** * Extending classes should invoke this method when a new stream was created * by the remote muxer */ onRemoteStream(stream: MuxedStream): void; private cleanUpStream; addEventListener>(type: K, listener: EventHandler[K]> | null, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventHandler, options?: boolean | AddEventListenerOptions): void; /** * A new outgoing stream needs to be created */ abstract onCreateStream(options: CreateStreamOptions): MuxedStream | Promise; /** * Multiplexed data was received from the remote muxer */ abstract onData(data: Uint8Array | Uint8ArrayList): void; } //# sourceMappingURL=abstract-stream-muxer.d.ts.map