storage.graphql 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. type StorageBucketOperatorStatusMissing {
  2. phantom: Int
  3. }
  4. type StorageBucketOperatorStatusInvited {
  5. workerId: Int!
  6. }
  7. type StorageBucketOperatorStatusActive {
  8. workerId: Int!
  9. transactorAccountId: String!
  10. }
  11. union StorageBucketOperatorStatus =
  12. StorageBucketOperatorStatusMissing
  13. | StorageBucketOperatorStatusInvited
  14. | StorageBucketOperatorStatusActive
  15. type GeoCoordinates {
  16. latitude: Float!
  17. longitude: Float!
  18. }
  19. enum Continent {
  20. AF
  21. NA
  22. OC
  23. AN
  24. AS
  25. EU
  26. SA
  27. }
  28. type GeographicalAreaContinent {
  29. continentCode: Continent
  30. }
  31. type GeographicalAreaCountry {
  32. "ISO 3166-1 alpha-2 country code"
  33. countryCode: String
  34. }
  35. type GeographicalAreaSubdivistion {
  36. "ISO 3166-2 subdivision code"
  37. subdivisionCode: String
  38. }
  39. union GeographicalArea =
  40. GeographicalAreaContinent
  41. | GeographicalAreaCountry
  42. | GeographicalAreaSubdivistion
  43. type NodeLocationMetadata {
  44. "ISO 3166-1 alpha-2 country code (2 letters)"
  45. countryCode: String
  46. "City name"
  47. city: String
  48. "Geographic coordinates"
  49. coordinates: GeoCoordinates
  50. }
  51. type StorageBucketOperatorMetadata @entity {
  52. id: ID!
  53. "Storage bucket to which the metadata is assigned"
  54. storageBucket: StorageBucket! @unique
  55. "Root node endpoint"
  56. nodeEndpoint: String
  57. "Optional node location metadata"
  58. nodeLocation: NodeLocationMetadata
  59. "Additional information about the node/operator"
  60. extra: String
  61. }
  62. type StorageBucket @entity {
  63. "Runtime bucket id"
  64. id: ID!
  65. "Current bucket operator status"
  66. operatorStatus: StorageBucketOperatorStatus!
  67. "Storage bucket operator metadata"
  68. operatorMetadata: StorageBucketOperatorMetadata @derivedFrom(field: "storageBucket")
  69. "Whether the bucket is accepting any new storage bags"
  70. acceptingNewBags: Boolean!
  71. "Storage bags assigned to the bucket"
  72. bags: [StorageBucketBag!] @derivedFrom(field: "storageBucket")
  73. "Bucket's data object size limit in bytes"
  74. dataObjectsSizeLimit: BigInt!
  75. "Bucket's data object count limit"
  76. dataObjectCountLimit: BigInt!
  77. "Number of assigned data objects"
  78. dataObjectsCount: BigInt!
  79. "Total size of assigned data objects"
  80. dataObjectsSize: BigInt!
  81. }
  82. type StorageBagOwnerCouncil {
  83. phantom: Int
  84. }
  85. type StorageBagOwnerWorkingGroup {
  86. workingGroupId: String
  87. }
  88. type StorageBagOwnerMember {
  89. memberId: String!
  90. }
  91. type StorageBagOwnerChannel {
  92. channelId: String!
  93. }
  94. # Note: Not supported by runtime yet
  95. type StorageBagOwnerDAO {
  96. daoId: Int
  97. }
  98. union StorageBagOwner =
  99. StorageBagOwnerCouncil
  100. | StorageBagOwnerWorkingGroup
  101. | StorageBagOwnerMember
  102. | StorageBagOwnerChannel
  103. | StorageBagOwnerDAO
  104. type StorageBag @entity {
  105. "Storage bag id"
  106. id: ID!
  107. "Data objects in the bag"
  108. objects: [StorageDataObject!] @derivedFrom(field: "storageBag")
  109. "Storage buckets assigned to the bag"
  110. storageBuckets: [StorageBucketBag!] @derivedFrom(field: "bag")
  111. "Distribution buckets assigned to the bag"
  112. distributionBuckets: [DistributionBucketBag!] @derivedFrom(field: "bag")
  113. "Owner of the storage bag"
  114. owner: StorageBagOwner!
  115. }
  116. type StorageBucketBag @entity @index(fields: ["storageBucket", "bag"], unique: true) {
  117. "{storageBucketId}-{storageBagId}"
  118. id: ID!
  119. storageBucket: StorageBucket!
  120. bag: StorageBag!
  121. }
  122. type DistributionBucketBag @entity @index(fields: ["distributionBucket", "bag"], unique: true) {
  123. "{distributionBucketId}-{storageBagId}"
  124. id: ID!
  125. distributionBucket: DistributionBucket!
  126. bag: StorageBag!
  127. }
  128. type DataObjectTypeChannelAvatar {
  129. "Related channel entity"
  130. channel: Channel!
  131. }
  132. type DataObjectTypeChannelCoverPhoto {
  133. "Related channel entity"
  134. channel: Channel!
  135. }
  136. type DataObjectTypeVideoMedia {
  137. "Related video entity"
  138. video: Video!
  139. }
  140. type DataObjectTypeVideoThumbnail {
  141. "Related video entity"
  142. video: Video!
  143. }
  144. type DataObjectTypeVideoSubtitle {
  145. "Related subtitle entity"
  146. subtitle: VideoSubtitle!
  147. # Useful for filtering subtitles against video, since
  148. # relationship filtering through variant is not supported
  149. "Related video entity"
  150. video: Video!
  151. }
  152. type DataObjectTypeChannelPayoutsPayload {
  153. phantom: Int
  154. }
  155. union DataObjectType =
  156. DataObjectTypeChannelAvatar
  157. | DataObjectTypeChannelCoverPhoto
  158. | DataObjectTypeVideoMedia
  159. | DataObjectTypeVideoThumbnail
  160. | DataObjectTypeVideoSubtitle
  161. | DataObjectTypeChannelPayoutsPayload
  162. type StorageDataObject @entity {
  163. "Data object runtime id"
  164. id: ID!
  165. "Timestamp of the block the data object was created at"
  166. createdAt: DateTime!
  167. "Whether the data object was uploaded and accepted by the storage provider"
  168. isAccepted: Boolean!
  169. "Data object size in bytes"
  170. size: BigInt!
  171. "Storage bag the data object is part of"
  172. storageBag: StorageBag!
  173. "IPFS content hash"
  174. ipfsHash: String!
  175. "The type of the asset that the data object represents (if known)"
  176. type: DataObjectType
  177. "State Bloat Bond for removing the data object"
  178. stateBloatBond: BigInt!
  179. "If the object is no longer used as an asset - the time at which it was unset (if known)"
  180. unsetAt: DateTime
  181. "Resolved asset urls"
  182. # This field should be populated with [dataObjectId] and will be then resolved by Orion's GraphQL
  183. # server during query resolution
  184. resolvedUrls: [String!]!
  185. }
  186. type DistributionBucketFamilyMetadata @entity {
  187. id: ID!
  188. "Distribution bucket family"
  189. family: DistributionBucketFamily! @unique
  190. "Name of the geographical region covered by the family (ie.: us-east-1)"
  191. region: String @index
  192. "Optional, more specific description of the region covered by the family"
  193. description: String
  194. "Geographical areas covered by the family"
  195. areas: [GeographicalArea!]
  196. "List of targets (hosts/ips) best suited latency measurements for the family"
  197. latencyTestTargets: [String]
  198. }
  199. type DistributionBucketOperatorMetadata @entity {
  200. id: ID!
  201. "Distribution bucket operator"
  202. distirbutionBucketOperator: DistributionBucketOperator! @unique
  203. "Root distributor node api endpoint"
  204. nodeEndpoint: String
  205. "Optional node location metadata"
  206. nodeLocation: NodeLocationMetadata
  207. "Additional information about the node/operator"
  208. extra: String
  209. }
  210. enum DistributionBucketOperatorStatus {
  211. INVITED
  212. ACTIVE
  213. }
  214. type DistributionBucketOperator @entity {
  215. "{bucketId}-{workerId}"
  216. id: ID!
  217. "Related distirbution bucket"
  218. distributionBucket: DistributionBucket!
  219. "ID of the distribution group worker"
  220. workerId: Int!
  221. "Current operator status"
  222. status: DistributionBucketOperatorStatus!
  223. "Operator metadata"
  224. metadata: DistributionBucketOperatorMetadata @derivedFrom(field: "distirbutionBucketOperator")
  225. }
  226. type DistributionBucket @entity {
  227. "Runtime bucket id in {familyId}:{bucketIndex} format"
  228. id: ID!
  229. "Distribution family the bucket is part of"
  230. family: DistributionBucketFamily!
  231. "Bucket index within the family"
  232. bucketIndex: Int!
  233. "Distribution bucket operators (either active or invited)"
  234. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  235. "Whether the bucket is accepting any new bags"
  236. acceptingNewBags: Boolean!
  237. "Whether the bucket is currently distributing content"
  238. distributing: Boolean!
  239. "Storage bags assigned to the bucket"
  240. bags: [DistributionBucketBag!] @derivedFrom(field: "distributionBucket")
  241. }
  242. type DistributionBucketFamily @entity {
  243. "Runtime bucket family id"
  244. id: ID!
  245. "Current bucket family metadata"
  246. metadata: DistributionBucketFamilyMetadata @derivedFrom(field: "family")
  247. "Distribution buckets belonging to the family"
  248. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  249. }