summaryrefslogtreecommitdiff
path: root/src/services/chart/charts/classes/network.ts
blob: 8b26e5c4c22f10c614c27f0e8dbe082088266322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import autobind from 'autobind-decorator';
import Chart, { DeepPartial } from '../../core';
import { SchemaType } from '../../../../misc/schema';
import { name, schema } from '../schemas/network';

type NetworkLog = SchemaType<typeof schema>;

export default class NetworkChart extends Chart<NetworkLog> {
	constructor() {
		super(name, schema);
	}

	@autobind
	protected genNewLog(latest: NetworkLog): DeepPartial<NetworkLog> {
		return {};
	}

	@autobind
	protected async fetchActual(): Promise<DeepPartial<NetworkLog>> {
		return {};
	}

	@autobind
	public async update(incomingRequests: number, time: number, incomingBytes: number, outgoingBytes: number) {
		const inc: DeepPartial<NetworkLog> = {
			incomingRequests: incomingRequests,
			totalTime: time,
			incomingBytes: incomingBytes,
			outgoingBytes: outgoingBytes
		};

		await this.inc(inc);
	}
}