storage.graphql 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. "Global storage system parameters"
  2. type StorageSystemParameters @entity {
  3. "Blacklisted content hashes"
  4. blacklist: [String!]
  5. "How many buckets can be assigned to store a bag"
  6. storageBucketsPerBagLimit: Int!
  7. "How many buckets can be assigned to distribute a bag"
  8. distributionBucketsPerBagLimit: Int!
  9. "Whether the uploading is globally blocked"
  10. uploadingBlocked: Boolean!
  11. "Additional fee for storing 1 MB of data"
  12. dataObjectFeePerMB: BigInt!
  13. "Global max. number of objects a storage bucket can store (can also be further limitted the provider)"
  14. storageBucketMaxObjectsCountLimit: BigInt!
  15. "Global max. size of objects a storage bucket can store (can also be further limitted the provider)"
  16. storageBucketMaxObjectsSizeLimit: BigInt!
  17. "ID of the next data object when created"
  18. nextDataObjectId: BigInt!
  19. }
  20. type StorageBucketOperatorStatusMissing @variant {
  21. _phantom: Int
  22. }
  23. type StorageBucketOperatorStatusInvited @variant {
  24. workerId: Int!
  25. }
  26. type StorageBucketOperatorStatusActive @variant {
  27. workerId: Int!
  28. transactorAccountId: String!
  29. }
  30. union StorageBucketOperatorStatus =
  31. StorageBucketOperatorStatusMissing
  32. | StorageBucketOperatorStatusInvited
  33. | StorageBucketOperatorStatusActive
  34. type GeoCoordinates @entity {
  35. latitude: Float!
  36. longitude: Float!
  37. }
  38. enum Continent {
  39. AF
  40. NA
  41. OC
  42. AN
  43. AS
  44. EU
  45. SA
  46. }
  47. type GeographicalAreaContinent @variant {
  48. code: Continent
  49. }
  50. type GeographicalAreaCountry @variant {
  51. "ISO 3166-1 alpha-2 country code"
  52. code: String
  53. }
  54. type GeographicalAreaSubdivistion @variant {
  55. "ISO 3166-2 subdivision code"
  56. code: String
  57. }
  58. union GeographicalArea = GeographicalAreaContinent | GeographicalAreaCountry | GeographicalAreaSubdivistion
  59. type NodeLocationMetadata @entity {
  60. "ISO 3166-1 alpha-2 country code (2 letters)"
  61. countryCode: String
  62. "City name"
  63. city: String
  64. "Geographic coordinates"
  65. coordinates: GeoCoordinates
  66. }
  67. type StorageBucketOperatorMetadata @entity {
  68. "Root node endpoint"
  69. nodeEndpoint: String
  70. "Optional node location metadata"
  71. nodeLocation: NodeLocationMetadata
  72. "Additional information about the node/operator"
  73. extra: String
  74. }
  75. type StorageBucket @entity {
  76. "Runtime bucket id"
  77. id: ID!
  78. "Current bucket operator status"
  79. operatorStatus: StorageBucketOperatorStatus!
  80. "Storage bucket operator metadata"
  81. operatorMetadata: StorageBucketOperatorMetadata
  82. "Whether the bucket is accepting any new storage bags"
  83. acceptingNewBags: Boolean!
  84. "Storage bags assigned to the bucket"
  85. bags: [StorageBag!] @derivedFrom(field: "storageBuckets")
  86. "Bucket's data object size limit in bytes"
  87. dataObjectsSizeLimit: BigInt!
  88. "Bucket's data object count limit"
  89. dataObjectCountLimit: BigInt!
  90. "Number of assigned data objects"
  91. dataObjectsCount: BigInt!
  92. "Total size of assigned data objects"
  93. dataObjectsSize: BigInt!
  94. }
  95. type StorageBagOwnerCouncil @variant {
  96. _phantom: Int
  97. }
  98. type StorageBagOwnerWorkingGroup @variant {
  99. workingGroupId: String
  100. }
  101. type StorageBagOwnerMember @variant {
  102. memberId: Int
  103. }
  104. type StorageBagOwnerChannel @variant {
  105. channelId: Int
  106. }
  107. # Note: Not supported by runtime yet
  108. type StorageBagOwnerDAO @variant {
  109. daoId: Int
  110. }
  111. union StorageBagOwner =
  112. StorageBagOwnerCouncil
  113. | StorageBagOwnerWorkingGroup
  114. | StorageBagOwnerMember
  115. | StorageBagOwnerChannel
  116. | StorageBagOwnerDAO
  117. type StorageBag @entity {
  118. "Storage bag id"
  119. id: ID!
  120. "Data objects in the bag"
  121. objects: [StorageDataObject!] @derivedFrom(field: "storageBag")
  122. "Storage buckets assigned to the bag"
  123. storageBuckets: [StorageBucket!]
  124. "Distribution buckets assigned to the bag"
  125. distributionBuckets: [DistributionBucket!]
  126. "Owner of the storage bag"
  127. owner: StorageBagOwner!
  128. }
  129. type DataObjectTypeChannelAvatar @variant {
  130. "Related channel entity"
  131. channel: Channel!
  132. }
  133. type DataObjectTypeChannelCoverPhoto @variant {
  134. "Related channel entity"
  135. channel: Channel!
  136. }
  137. type DataObjectTypeVideoMedia @variant {
  138. "Related video entity"
  139. video: Video!
  140. }
  141. type DataObjectTypeVideoThumbnail @variant {
  142. "Related video entity"
  143. video: Video!
  144. }
  145. type DataObjectTypeUnknown @variant {
  146. _phantom: Int
  147. }
  148. union DataObjectType =
  149. DataObjectTypeChannelAvatar
  150. | DataObjectTypeChannelCoverPhoto
  151. | DataObjectTypeVideoMedia
  152. | DataObjectTypeVideoThumbnail
  153. | DataObjectTypeUnknown
  154. type StorageDataObject @entity {
  155. "Data object runtime id"
  156. id: ID!
  157. "Whether the data object was uploaded and accepted by the storage provider"
  158. isAccepted: Boolean!
  159. "Data object size in bytes"
  160. size: BigInt!
  161. "Storage bag the data object is part of"
  162. storageBag: StorageBag!
  163. "IPFS content hash"
  164. ipfsHash: String!
  165. # FIXME: Cannot be optional because: https://github.com/Joystream/hydra/issues/434
  166. "The type of the asset that the data object represents (if known)"
  167. type: DataObjectType!
  168. "Prize for removing the data object"
  169. deletionPrize: BigInt!
  170. "If the object is no longer used as an asset - the time at which it was unset (if known)"
  171. unsetAt: DateTime
  172. "Video that has this data object associated as thumbnail photo."
  173. videoThumbnail: Video @derivedFrom(field: "thumbnailPhoto")
  174. "Video that has this data object associated as media."
  175. videoMedia: Video @derivedFrom(field: "media")
  176. }
  177. type DistributionBucketFamilyGeographicArea @entity {
  178. "{metadataId}-{(C|c|s)}-{code}"
  179. id: ID!
  180. "Geographical area (continent / country / subdivision)"
  181. area: GeographicalArea!
  182. "Related distribution bucket family metadata"
  183. distributionBucketFamilyMetadata: DistributionBucketFamilyMetadata!
  184. }
  185. type DistributionBucketFamilyMetadata @entity {
  186. "Name of the geographical region covered by the family (ie.: us-east-1)"
  187. region: String
  188. "Optional, more specific description of the region covered by the family"
  189. description: String
  190. "Geographical areas covered by the family"
  191. areas: [DistributionBucketFamilyGeographicArea!] @derivedFrom(field: "distributionBucketFamilyMetadata")
  192. "List of targets (hosts/ips) best suited latency measurements for the family"
  193. latencyTestTargets: [String]
  194. }
  195. type DistributionBucketOperatorMetadata @entity {
  196. "Root distributor node api endpoint"
  197. nodeEndpoint: String
  198. "Optional node location metadata"
  199. nodeLocation: NodeLocationMetadata
  200. "Additional information about the node/operator"
  201. extra: String
  202. }
  203. enum DistributionBucketOperatorStatus {
  204. INVITED
  205. ACTIVE
  206. }
  207. type DistributionBucketOperator @entity {
  208. "{bucketId}-{workerId}"
  209. id: ID!
  210. "Related distirbution bucket"
  211. distributionBucket: DistributionBucket!
  212. "ID of the distribution group worker"
  213. workerId: Int!
  214. "Current operator status"
  215. status: DistributionBucketOperatorStatus!
  216. "Operator metadata"
  217. metadata: DistributionBucketOperatorMetadata
  218. }
  219. type DistributionBucket @entity {
  220. "Runtime bucket id in {familyId}:{bucketIndex} format"
  221. id: ID!
  222. "Distribution family the bucket is part of"
  223. family: DistributionBucketFamily!
  224. "Bucket index within the family"
  225. bucketIndex: Int!
  226. "Distribution bucket operators (either active or invited)"
  227. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  228. "Whether the bucket is accepting any new bags"
  229. acceptingNewBags: Boolean!
  230. "Whether the bucket is currently distributing content"
  231. distributing: Boolean!
  232. "Storage bags assigned to the bucket"
  233. bags: [StorageBag!] @derivedFrom(field: "distributionBuckets")
  234. }
  235. type DistributionBucketFamily @entity {
  236. "Runtime bucket family id"
  237. id: ID!
  238. "Current bucket family metadata"
  239. metadata: DistributionBucketFamilyMetadata
  240. "Distribution buckets belonging to the family"
  241. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  242. }