diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-05 13:26:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-05 14:14:16 +0200 |
commit | 6fcd19ba737f1f5614a56c6925adb882dea43b8d (patch) | |
tree | 3365a96d82bc7f00ae504a568725c8e914150cf8 /server/models/request/request-interface.ts | |
parent | 5fe7e898316e18369c3e1aba307b55077adc7bfb (diff) | |
download | PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.gz PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.tar.zst PeerTube-6fcd19ba737f1f5614a56c6925adb882dea43b8d.zip |
Move to promises
Closes https://github.com/Chocobozzz/PeerTube/issues/74
Diffstat (limited to 'server/models/request/request-interface.ts')
-rw-r--r-- | server/models/request/request-interface.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/server/models/request/request-interface.ts b/server/models/request/request-interface.ts index 483850633..7b0ee4df9 100644 --- a/server/models/request/request-interface.ts +++ b/server/models/request/request-interface.ts | |||
@@ -1,5 +1,7 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | ||
2 | 3 | ||
4 | import { AbstractRequestClass } from './abstract-request-interface' | ||
3 | import { PodInstance, PodAttributes } from '../pod' | 5 | import { PodInstance, PodAttributes } from '../pod' |
4 | import { RequestEndpoint } from '../../../shared/models/request-scheduler.model' | 6 | import { RequestEndpoint } from '../../../shared/models/request-scheduler.model' |
5 | 7 | ||
@@ -11,20 +13,16 @@ export type RequestsGrouped = { | |||
11 | } | 13 | } |
12 | 14 | ||
13 | export namespace RequestMethods { | 15 | export namespace RequestMethods { |
14 | export type CountTotalRequestsCallback = (err: Error, total: number) => void | 16 | export type CountTotalRequests = () => Promise<number> |
15 | export type CountTotalRequests = (callback: CountTotalRequestsCallback) => void | ||
16 | 17 | ||
17 | export type ListWithLimitAndRandomCallback = (err: Error, requestsGrouped?: RequestsGrouped) => void | 18 | export type ListWithLimitAndRandom = (limitPods: number, limitRequestsPerPod: number) => Promise<RequestsGrouped> |
18 | export type ListWithLimitAndRandom = (limitPods, limitRequestsPerPod, callback: ListWithLimitAndRandomCallback) => void | ||
19 | 19 | ||
20 | export type RemoveWithEmptyToCallback = (err: Error) => void | 20 | export type RemoveWithEmptyTo = () => Promise<number> |
21 | export type RemoveWithEmptyTo = (callback: RemoveWithEmptyToCallback) => void | ||
22 | 21 | ||
23 | export type RemoveAllCallback = (err: Error) => void | 22 | export type RemoveAll = () => Promise<void> |
24 | export type RemoveAll = (callback: RemoveAllCallback) => void | ||
25 | } | 23 | } |
26 | 24 | ||
27 | export interface RequestClass { | 25 | export interface RequestClass extends AbstractRequestClass<RequestsGrouped> { |
28 | countTotalRequests: RequestMethods.CountTotalRequests | 26 | countTotalRequests: RequestMethods.CountTotalRequests |
29 | listWithLimitAndRandom: RequestMethods.ListWithLimitAndRandom | 27 | listWithLimitAndRandom: RequestMethods.ListWithLimitAndRandom |
30 | removeWithEmptyTo: RequestMethods.RemoveWithEmptyTo | 28 | removeWithEmptyTo: RequestMethods.RemoveWithEmptyTo |