-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphql
147 lines (110 loc) · 3.56 KB
/
schema.graphql
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
type Account @entity {
id: ID!
cereFreeBalance: BigInt!
ddcActiveBalance: BigInt!
ddcBucketsUsage: [DdcCustomerUsage!]! @derivedFrom(field: "accountId")
ddcCustomerDeposits: [DdcCustomerDeposit!]! @derivedFrom(field: "accountId")
ddcCustomerCharges: [DdcCustomerCharge!]! @derivedFrom(field: "accountId")
ddcBuckets: [DdcBucket!] @derivedFrom(field: "ownerId")
ddcClusters: [DdcCluster!] @derivedFrom(field: "managerId")
ddcNodes: [DdcNode!] @derivedFrom(field: "providerId")
}
type DdcCustomerUsage @entity @index(fields: ["blockHeight", "accountId"]) @index(fields: ["blockTimestamp", "accountId"]) {
# Can't avoid having id column due a lack of support for `PRIMARY KEY("blockHeight", "accountId")`.
# Expected value is blockHeight || '-' || accountId .
id: ID!
blockHeight: Int! @index
blockTimestamp: DateTime! @index
accountId: Account! @index
transferredBytes: BigInt!
storedBytes: BigInt!
numberOfPuts: BigInt!
numberOfGets: BigInt!
}
type DdcCustomerDeposit @entity @index(fields: ["blockTimestamp", "amount"]) {
id: ID!
blockTimestamp: DateTime! @index
accountId: Account! @index
amount: BigInt!
}
type DdcCustomerCharge @entity @index(fields: ["blockTimestamp", "amount"]) {
id: ID!
blockTimestamp: DateTime! @index
accountId: Account! @index
amount: BigInt!
}
type DdcCluster @entity {
id: ID!
createdAtBlockHeight: Int!
managerId: Account! @index
treasuryShare: BigInt!
validatorsShare: BigInt!
clusterReserveShare: BigInt!
storageBondSize: BigInt!
storageChillDelay: Int!
storageUnbondingDelay: Int!
unitPerMbStored: BigInt!
unitPerMbStreamed: BigInt!
unitPerPutRequest: BigInt!
unitPerGetRequest: BigInt!
erasureCodingRequired: Int!
erasureCodingTotal: Int!
replicationTotal: Int!
status: DdcClusterStatus!
ddcBuckets: [DdcBucket!] @derivedFrom(field: "clusterId")
ddcNodes: [DdcNode!] @derivedFrom(field: "clusterId")
}
enum DdcClusterStatus {
Activated, Bonded, Unbonded, Unbonding
}
type DdcNode @entity {
id: ID!
createdAtBlockHeight: Int!
providerId: Account! @index
clusterId: DdcCluster
host: String!
domain: String
ssl: Boolean!
httpPort: Int!
grpcPort: Int!
p2pPort: Int!
mode: DdcNodeMode!
usage: [DdcNodeUsage!]! @derivedFrom(field: "nodeId")
}
enum DdcNodeMode {
Storage, Cache, Full, DAC
}
type DdcNodeUsage @entity @index(fields: ["blockHeight", "nodeId"]) @index(fields: ["blockTimestamp", "nodeId"]) {
# Can't avoid having id column due a lack of support for `PRIMARY KEY("blockHeight", "nodeId")`.
# Expected value is blockHeight || '-' || nodeId.
id: ID!
blockHeight: Int! @index
blockTimestamp: DateTime! @index
nodeId: DdcNode! @index
transferredBytes: BigInt!
storedBytes: BigInt!
numberOfPuts: BigInt!
numberOfGets: BigInt!
}
type DdcBucket @entity @index(fields: ["createdAtBlockTimestamp", "id"]) {
id: ID!
createdAtBlockHeight: Int!
createdAtBlockTimestamp: DateTime! @index
ownerId: Account! @index
clusterId: DdcCluster! @index
isPublic: Boolean!
isRemoved: Boolean!
usage: [DdcBucketUsage!]! @derivedFrom(field: "bucketId")
}
type DdcBucketUsage @entity @index(fields: ["blockHeight", "bucketId"]) @index(fields: ["blockTimestamp", "bucketId"]) {
# Can't avoid having id column due a lack of support for `PRIMARY KEY("blockHeight", "bucketId")`.
# Expected value is blockHeight || '-' || bucketId .
id: ID!
blockHeight: Int! @index
blockTimestamp: DateTime! @index
bucketId: DdcBucket! @index
transferredBytes: BigInt!
storedBytes: BigInt!
numberOfPuts: BigInt!
numberOfGets: BigInt!
}