storage.graphql 7.2 KB

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