aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request/request-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-05 13:26:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-05 14:14:16 +0200
commit6fcd19ba737f1f5614a56c6925adb882dea43b8d (patch)
tree3365a96d82bc7f00ae504a568725c8e914150cf8 /server/models/request/request-interface.ts
parent5fe7e898316e18369c3e1aba307b55077adc7bfb (diff)
downloadPeerTube-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.ts16
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 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
2 3
4import { AbstractRequestClass } from './abstract-request-interface'
3import { PodInstance, PodAttributes } from '../pod' 5import { PodInstance, PodAttributes } from '../pod'
4import { RequestEndpoint } from '../../../shared/models/request-scheduler.model' 6import { RequestEndpoint } from '../../../shared/models/request-scheduler.model'
5 7
@@ -11,20 +13,16 @@ export type RequestsGrouped = {
11} 13}
12 14
13export namespace RequestMethods { 15export 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
27export interface RequestClass { 25export 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