Add server id property and persistence namespace

This commit is contained in:
jerray 2018-08-15 13:58:19 +08:00
parent 7a15941349
commit b6cf2fda64

View File

@ -1,9 +1,11 @@
// Type definitions for mosca 2.8
// Project: https://github.com/mcollina/mosca
// Definitions by: Joao Gabriel Gouveia <https://github.com/GabrielGouv>
// Jerray Fu <https://github.com/jerray>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class Server {
id: string;
opts: any;
modernOpts: any;
clients: any;
@ -83,3 +85,15 @@ export interface Message {
qos: number;
retain: boolean;
}
export namespace persistence {
interface Persistence {
wire(server: Server): void;
}
type FactoryFunc = (options: { [key: string]: any }) => Persistence;
const Redis: FactoryFunc;
const Mongo: FactoryFunc;
const LevelUp: FactoryFunc;
const Memory: FactoryFunc;
}