storage.graphql 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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. union DataObjectType =
  153. DataObjectTypeChannelAvatar
  154. | DataObjectTypeChannelCoverPhoto
  155. | DataObjectTypeVideoMedia
  156. | DataObjectTypeVideoThumbnail
  157. | DataObjectTypeVideoSubtitle
  158. type StorageDataObject @entity {
  159. "Data object runtime id"
  160. id: ID!
  161. "Timestamp of the block the data object was created at"
  162. createdAt: DateTime!
  163. "Whether the data object was uploaded and accepted by the storage provider"
  164. isAccepted: Boolean!
  165. "Data object size in bytes"
  166. size: BigInt!
  167. "Storage bag the data object is part of"
  168. storageBag: StorageBag!
  169. "IPFS content hash"
  170. ipfsHash: String!
  171. "The type of the asset that the data object represents (if known)"
  172. type: DataObjectType
  173. "State Bloat Bond for removing the data object"
  174. stateBloatBond: BigInt!
  175. "If the object is no longer used as an asset - the time at which it was unset (if known)"
  176. unsetAt: DateTime
  177. "Resolved asset urls"
  178. # This field should be populated with [dataObjectId] and will be then resolved by Orion's GraphQL
  179. # server during query resolution
  180. resolvedUrls: [String!]!
  181. }
  182. type DistributionBucketFamilyMetadata @entity {
  183. id: ID!
  184. "Distribution bucket family"
  185. family: DistributionBucketFamily! @unique
  186. "Name of the geographical region covered by the family (ie.: us-east-1)"
  187. region: String @index
  188. "Optional, more specific description of the region covered by the family"
  189. description: String
  190. "Geographical areas covered by the family"
  191. areas: [GeographicalArea!]
  192. "List of targets (hosts/ips) best suited latency measurements for the family"
  193. latencyTestTargets: [String]
  194. }
  195. type DistributionBucketOperatorMetadata @entity {
  196. id: ID!
  197. "Distribution bucket operator"
  198. distirbutionBucketOperator: DistributionBucketOperator! @unique
  199. "Root distributor node api endpoint"
  200. nodeEndpoint: String
  201. "Optional node location metadata"
  202. nodeLocation: NodeLocationMetadata
  203. "Additional information about the node/operator"
  204. extra: String
  205. }
  206. enum DistributionBucketOperatorStatus {
  207. INVITED
  208. ACTIVE
  209. }
  210. type DistributionBucketOperator @entity {
  211. "{bucketId}-{workerId}"
  212. id: ID!
  213. "Related distirbution bucket"
  214. distributionBucket: DistributionBucket!
  215. "ID of the distribution group worker"
  216. workerId: Int!
  217. "Current operator status"
  218. status: DistributionBucketOperatorStatus!
  219. "Operator metadata"
  220. metadata: DistributionBucketOperatorMetadata @derivedFrom(field: "distirbutionBucketOperator")
  221. }
  222. type DistributionBucket @entity {
  223. "Runtime bucket id in {familyId}:{bucketIndex} format"
  224. id: ID!
  225. "Distribution family the bucket is part of"
  226. family: DistributionBucketFamily!
  227. "Bucket index within the family"
  228. bucketIndex: Int!
  229. "Distribution bucket operators (either active or invited)"
  230. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  231. "Whether the bucket is accepting any new bags"
  232. acceptingNewBags: Boolean!
  233. "Whether the bucket is currently distributing content"
  234. distributing: Boolean!
  235. "Storage bags assigned to the bucket"
  236. bags: [DistributionBucketBag!] @derivedFrom(field: "distributionBucket")
  237. }
  238. type DistributionBucketFamily @entity {
  239. "Runtime bucket family id"
  240. id: ID!
  241. "Current bucket family metadata"
  242. metadata: DistributionBucketFamilyMetadata @derivedFrom(field: "family")
  243. "Distribution buckets belonging to the family"
  244. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  245. }