aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/pod/pod-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 11:00:25 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit608624252466acf9f1d9ee1c1170bd4fe4d18d18 (patch)
tree47eab55bb5421b7fe88e0b2ac743a436fd9561cf /server/models/pod/pod-interface.ts
parent51548b31815c6f96f314ae96588a9adca150519d (diff)
downloadPeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.gz
PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.zst
PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.zip
Rename Pod -> Server
Diffstat (limited to 'server/models/pod/pod-interface.ts')
-rw-r--r--server/models/pod/pod-interface.ts61
1 files changed, 0 insertions, 61 deletions
diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.ts
deleted file mode 100644
index 6c5aab3fa..000000000
--- a/server/models/pod/pod-interface.ts
+++ /dev/null
@@ -1,61 +0,0 @@
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
3
4// Don't use barrel, import just what we need
5import { Pod as FormattedPod } from '../../../shared/models/pods/pod.model'
6import { ResultList } from '../../../shared/models/result-list.model'
7
8export namespace PodMethods {
9 export type ToFormattedJSON = (this: PodInstance) => FormattedPod
10
11 export type CountAll = () => Promise<number>
12
13 export type IncrementScores = (ids: number[], value: number) => Promise<[ number, PodInstance[] ]>
14
15 export type List = () => Promise<PodInstance[]>
16
17 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<PodInstance> >
18
19 export type ListAllIds = (transaction: Sequelize.Transaction) => Promise<number[]>
20
21 export type ListRandomPodIdsWithRequest = (limit: number, tableWithPods: string, tableWithPodsJoins: string) => Promise<number[]>
22
23 export type ListBadPods = () => Promise<PodInstance[]>
24
25 export type Load = (id: number) => Promise<PodInstance>
26
27 export type LoadByHost = (host: string) => Promise<PodInstance>
28
29 export type RemoveAll = () => Promise<number>
30
31 export type UpdatePodsScore = (goodPods: number[], badPods: number[]) => void
32}
33
34export interface PodClass {
35 countAll: PodMethods.CountAll
36 incrementScores: PodMethods.IncrementScores
37 list: PodMethods.List
38 listForApi: PodMethods.ListForApi
39 listAllIds: PodMethods.ListAllIds
40 listRandomPodIdsWithRequest: PodMethods.ListRandomPodIdsWithRequest
41 listBadPods: PodMethods.ListBadPods
42 load: PodMethods.Load
43 loadByHost: PodMethods.LoadByHost
44 removeAll: PodMethods.RemoveAll
45 updatePodsScore: PodMethods.UpdatePodsScore
46}
47
48export interface PodAttributes {
49 id?: number
50 host?: string
51 score?: number | Sequelize.literal // Sequelize literal for 'score +' + value
52}
53
54export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> {
55 createdAt: Date
56 updatedAt: Date
57
58 toFormattedJSON: PodMethods.ToFormattedJSON,
59}
60
61export interface PodModel extends PodClass, Sequelize.Model<PodInstance, PodAttributes> {}