import { Subject } from 'rxjs'; import { Message } from './message.model'; import { UUID } from '../store/store.model'; /** * A Channel object represents a single channel on the message bus. * This enables many-to-many transactions. Anyone can send a packet on a stream, and anyone can subscribe to a stream. * There is no restriction on the object that is placed on a stream and its type is only known to the sender and the * receiver. * * The Channel stream allows for packets and errors to be transmitted and both can be received by subscribers. */ export interface Subscriber { id: UUID; subscribed: number; } export interface Observer { id: UUID; subscribed: number; } export declare class Channel { private _name; private _refCount; private _closed; private _galactic; private _private; private _streamObject; subscribers: Map; observers: Map; latestObserver: UUID; constructor(name: string); /** * Returns the stream object for subscription * * @returns {Subject} */ get stream(): Subject; createSubscriber(): UUID; removeSubscriber(uuid: UUID): boolean; getSubscriber(uuid: UUID): Subscriber; createObserver(): UUID; removeObserver(uuid: UUID): boolean; getObserver(uuid: UUID): Subscriber; /** * returns the channel identifier * * @returns {string} */ get name(): string; /** * returns state of stream. * * @returns {boolean} */ get isClosed(): boolean; /** * Transmit data on the stream after switching to event loop. * * @param message Message */ send(message: Message): void; /** * Transmit an error on the stream * * @param err */ error(err: any): void; /** * Transmit a completion on the stream */ complete(): void; increment(): number; decrement(): number; get refCount(): number; setGalactic(): this; setLocal(): this; get galactic(): boolean; setPrivate(): void; setPublic(): void; get isPrivate(): boolean; }