1 | import { Readable } from 'readable-stream';
|
2 | import { Packet } from 'mqtt-packet';
|
3 | import { DoneCallback } from './shared';
|
4 | export interface IStoreOptions {
|
5 | clean?: boolean;
|
6 | }
|
7 | export type PacketCallback = (error?: Error, packet?: Packet) => void;
|
8 | export interface IStore {
|
9 | put(packet: Packet, cb: DoneCallback): IStore;
|
10 | createStream(): Readable;
|
11 | del(packet: Pick<Packet, 'messageId'>, cb: PacketCallback): IStore;
|
12 | get(packet: Pick<Packet, 'messageId'>, cb: PacketCallback): IStore;
|
13 | close(cb: DoneCallback): void;
|
14 | }
|
15 | export default class Store implements IStore {
|
16 | private options;
|
17 | private _inflights;
|
18 | constructor(options?: IStoreOptions);
|
19 | put(packet: Packet, cb: DoneCallback): this;
|
20 | createStream(): Readable;
|
21 | del(packet: Pick<Packet, 'messageId'>, cb: PacketCallback): this;
|
22 | get(packet: Pick<Packet, 'messageId'>, cb: PacketCallback): this;
|
23 | close(cb: DoneCallback): void;
|
24 | }
|