storage.graphql 7.9 KB

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