Improve chart engine (#8253)
* wip * wip * wip * wip * wip * wip * wip * Update core.ts * wip * wip * #7361 * delete network chart * federationChart強化 apRequestChart追加 * tweak
This commit is contained in:
@@ -1,39 +1,24 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { DeepPartial } from '../core';
|
||||
import { SchemaType } from '@/misc/schema';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/test-unique';
|
||||
|
||||
type TestUniqueLog = SchemaType<typeof schema>;
|
||||
|
||||
/**
|
||||
* For testing
|
||||
*/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default class TestUniqueChart extends Chart<TestUniqueLog> {
|
||||
export default class TestUniqueChart extends Chart<typeof schema> {
|
||||
constructor() {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected genNewLog(latest: TestUniqueLog): DeepPartial<TestUniqueLog> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected aggregate(logs: TestUniqueLog[]): TestUniqueLog {
|
||||
return {
|
||||
foo: logs.reduce((a, b) => a.concat(b.foo), [] as TestUniqueLog['foo']),
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async fetchActual(): Promise<DeepPartial<TestUniqueLog>> {
|
||||
protected async queryCurrentState(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async uniqueIncrement(key: string): Promise<void> {
|
||||
await this.inc({
|
||||
await this.commit({
|
||||
foo: [key],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user