Refactoring: Move chart dir into services dir

This commit is contained in:
syuilo 2019-02-08 04:31:33 +09:00
parent e6612f610c
commit aba85b977d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
41 changed files with 53 additions and 53 deletions

View file

@ -1,64 +0,0 @@
import autobind from 'autobind-decorator';
import Chart, { Partial } from './';
/**
*
*/
type NetworkLog = {
/**
*
*/
incomingRequests: number;
/**
*
*/
outgoingRequests: number;
/**
*
* TIP: (totalTime / incomingRequests)
*/
totalTime: number;
/**
*
*/
incomingBytes: number;
/**
*
*/
outgoingBytes: number;
};
class NetworkChart extends Chart<NetworkLog> {
constructor() {
super('network');
}
@autobind
protected async getTemplate(init: boolean, latest?: NetworkLog): Promise<NetworkLog> {
return {
incomingRequests: 0,
outgoingRequests: 0,
totalTime: 0,
incomingBytes: 0,
outgoingBytes: 0
};
}
@autobind
public async update(incomingRequests: number, time: number, incomingBytes: number, outgoingBytes: number) {
const inc: Partial<NetworkLog> = {
incomingRequests: incomingRequests,
totalTime: time,
incomingBytes: incomingBytes,
outgoingBytes: outgoingBytes
};
await this.inc(inc);
}
}
export default new NetworkChart();