import { App } from './../app' ; import { LocalStats } from './local-stats' ; import { RedisStats } from './redis-stats' ; import { StatsDriver } from './stats-driver' ; export class Stats implements StatsDriver { type { StatsDriver } protected driver : StatsDriver ; param { any } options constructor ( options ) { if ( options . stats . driver === 'local' ) { this . driver = new LocalStats ( options ) ; } else if ( options . stats . driver === 'redis' ) { this . driver = new RedisStats ( options ) ; } } param { App } app return { Promise < number > } markNewConnection ( app ) { return this . driver . markNewConnection ( app ) ; } param { App } app param { string | null } reason return { Promise < number > } markDisconnection ( app , reason ? ) { return this . driver . markDisconnection ( app , reason ) ; } param { App } app return { Promise < number > } markApiMessage ( app ) { return this . driver . markApiMessage ( app ) ; } param { App } app return { Promise < number > } markWsMessage ( app ) { return this . driver . markWsMessage ( app ) ; } param { App | string } app return { Promise < any > } getStats ( app ) { return this . driver . getStats ( app ) ; } param { App | string } app param { number | null } time return { Promise < any > } takeSnapshot ( app , time ? ) { return this . driver . takeSnapshot ( app , time ) ; } param { App | string } app param { number | null } start param { number | null } end return { Promise < any > } getSnapshots ( app , start ? , end ? ) { return this . driver . getSnapshots ( app , start , end ) ; } param { App | string } app param { number | null } time return { Promise < boolean > } deleteStalePoints ( app , time ? ) { return this . driver . deleteStalePoints ( app , time ) ; } param { App | string } app return { Promise < boolean > } registerApp ( app ) { return this . driver . registerApp ( app ) ; } return { Promise < string [ ] > } getRegisteredApps ( ) { return this . driver . getRegisteredApps ( ) ; } }