storage.graphql 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. "Storage bags assigned to the bucket"
  81. bags: [StorageBag!] @derivedFrom(field: "storageBuckets")
  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. "Storage buckets assigned to the bag"
  114. storageBuckets: [StorageBucket!]
  115. "Distribution buckets assigned to the bag"
  116. distributionBuckets: [DistributionBucket!]
  117. "Owner of the storage bag"
  118. owner: StorageBagOwner!
  119. }
  120. type DataObjectTypeChannelAvatar @variant {
  121. "Related channel entity"
  122. channel: Channel!
  123. }
  124. type DataObjectTypeChannelCoverPhoto @variant {
  125. "Related channel entity"
  126. channel: Channel!
  127. }
  128. type DataObjectTypeVideoMedia @variant {
  129. "Related video entity"
  130. video: Video!
  131. }
  132. type DataObjectTypeVideoThumbnail @variant {
  133. "Related video entity"
  134. video: Video!
  135. }
  136. type DataObjectTypeUnknown @variant {
  137. _phantom: Int
  138. }
  139. union DataObjectType = DataObjectTypeChannelAvatar | DataObjectTypeChannelCoverPhoto | DataObjectTypeVideoMedia | DataObjectTypeVideoThumbnail | DataObjectTypeUnknown
  140. type StorageDataObject @entity {
  141. "Data object runtime id"
  142. id: ID!
  143. "Whether the data object was uploaded and accepted by the storage provider"
  144. isAccepted: Boolean!
  145. "Data object size in bytes"
  146. size: BigInt!
  147. "Storage bag the data object is part of"
  148. storageBag: StorageBag!
  149. "IPFS content hash"
  150. ipfsHash: String!
  151. # FIXME: Cannot be optional because: https://github.com/Joystream/hydra/issues/434
  152. "The type of the asset that the data object represents (if known)"
  153. type: DataObjectType!
  154. "Prize for removing the data object"
  155. deletionPrize: BigInt!
  156. "If the object is no longer used as an asset - the time at which it was unset (if known)"
  157. unsetAt: DateTime
  158. }
  159. type DistributionBucketFamilyGeographicArea @entity {
  160. "{metadataId}-{(C|c|s)}-{code}"
  161. id: ID!
  162. "Geographical area (continent / country / subdivision)"
  163. area: GeographicalArea!
  164. "Related distribution bucket family metadata"
  165. distributionBucketFamilyMetadata: DistributionBucketFamilyMetadata!
  166. }
  167. type DistributionBucketFamilyMetadata @entity {
  168. "Name of the geographical region covered by the family (ie.: us-east-1)"
  169. region: String
  170. "Optional, more specific description of the region covered by the family"
  171. description: String
  172. "Geographical areas covered by the family"
  173. areas: [DistributionBucketFamilyGeographicArea!] @derivedFrom(field: "distributionBucketFamilyMetadata")
  174. "List of targets (hosts/ips) best suited latency measurements for the family"
  175. latencyTestTargets: [String]
  176. }
  177. type DistributionBucketOperatorMetadata @entity {
  178. "Root distributor node api endpoint"
  179. nodeEndpoint: String
  180. "Optional node location metadata"
  181. nodeLocation: NodeLocationMetadata
  182. "Additional information about the node/operator"
  183. extra: String
  184. }
  185. enum DistributionBucketOperatorStatus {
  186. INVITED,
  187. ACTIVE
  188. }
  189. type DistributionBucketOperator @entity {
  190. "{bucketId}-{workerId}"
  191. id: ID!
  192. "Related distirbution bucket"
  193. distributionBucket: DistributionBucket!
  194. "ID of the distribution group worker"
  195. workerId: Int!
  196. "Current operator status"
  197. status: DistributionBucketOperatorStatus!
  198. "Operator metadata"
  199. metadata: DistributionBucketOperatorMetadata
  200. }
  201. type DistributionBucket @entity {
  202. "Runtime bucket id in {familyId}:{bucketIndex} format"
  203. id: ID!
  204. "Distribution family the bucket is part of"
  205. family: DistributionBucketFamily!
  206. "Bucket index within the family"
  207. bucketIndex: Int!
  208. "Distribution bucket operators (either active or invited)"
  209. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  210. "Whether the bucket is accepting any new bags"
  211. acceptingNewBags: Boolean!
  212. "Whether the bucket is currently distributing content"
  213. distributing: Boolean!
  214. "Storage bags assigned to the bucket"
  215. bags: [StorageBag!] @derivedFrom(field: "distributionBuckets")
  216. }
  217. type DistributionBucketFamily @entity {
  218. "Runtime bucket family id"
  219. id: ID!
  220. "Current bucket family metadata"
  221. metadata: DistributionBucketFamilyMetadata
  222. "Distribution buckets belonging to the family"
  223. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  224. }