storage.graphql 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. "Optional DistributionBucketFamilyMetadata reference in case the coordinates are part of a region boundary"
  34. boundarySourceBucketFamilyMeta: DistributionBucketFamilyMetadata
  35. }
  36. type NodeLocationMetadata @entity {
  37. "ISO 3166-1 alpha-2 country code (2 letters)"
  38. countryCode: String
  39. "City name"
  40. city: String
  41. "Geographic coordinates"
  42. coordinates: GeoCoordinates
  43. }
  44. type StorageBucketOperatorMetadata @entity {
  45. "Root node endpoint"
  46. nodeEndpoint: String
  47. "Optional node location metadata"
  48. nodeLocation: NodeLocationMetadata
  49. "Additional information about the node/operator"
  50. extra: String
  51. }
  52. type StorageBucket @entity {
  53. "Runtime bucket id"
  54. id: ID!
  55. "Current bucket operator status"
  56. operatorStatus: StorageBucketOperatorStatus!
  57. "Storage bucket operator metadata"
  58. operatorMetadata: StorageBucketOperatorMetadata
  59. "Whether the bucket is accepting any new storage bags"
  60. acceptingNewBags: Boolean!
  61. "Assignments to store a bag"
  62. bagAssignments: [StorageBagStorageAssignment!] @derivedFrom(field: "storageBucket")
  63. "Bucket's data object size limit in bytes"
  64. dataObjectsSizeLimit: BigInt!
  65. "Bucket's data object count limit"
  66. dataObjectCountLimit: BigInt!
  67. "Number of assigned data objects"
  68. dataObjectsCount: BigInt!
  69. "Total size of assigned data objects"
  70. dataObjectsSize: BigInt!
  71. }
  72. type StorageBagOwnerCouncil @variant {
  73. _phantom: Int
  74. }
  75. type StorageBagOwnerWorkingGroup @variant {
  76. workingGroupId: String
  77. }
  78. type StorageBagOwnerMember @variant {
  79. memberId: Int
  80. }
  81. type StorageBagOwnerChannel @variant {
  82. channelId: Int
  83. }
  84. # Note: Not supported by runtime yet
  85. type StorageBagOwnerDAO @variant {
  86. daoId: Int
  87. }
  88. union StorageBagOwner = StorageBagOwnerCouncil | StorageBagOwnerWorkingGroup | StorageBagOwnerMember | StorageBagOwnerChannel | StorageBagOwnerDAO
  89. type StorageBag @entity {
  90. "Storage bag id"
  91. id: ID!
  92. "Data objects in the bag"
  93. objects: [StorageDataObject!] @derivedFrom(field: "storageBag")
  94. "Assignments to a storage bucket"
  95. storageAssignments: [StorageBagStorageAssignment!] @derivedFrom(field: "storageBag")
  96. "Assignments to a distribution bucket"
  97. distirbutionAssignments: [StorageBagDistributionAssignment!] @derivedFrom(field: "storageBag")
  98. "Owner of the storage bag"
  99. owner: StorageBagOwner!
  100. }
  101. type StorageBagStorageAssignment @entity {
  102. "{storageBagId-storageBucketId}"
  103. id: ID!
  104. "Storage bag to be stored"
  105. storageBag: StorageBag!
  106. "Storage bucket that should store the bag"
  107. storageBucket: StorageBucket!
  108. # Relationship filtering workaround
  109. storageBagId: ID
  110. storageBucketId: ID
  111. }
  112. type StorageBagDistributionAssignment @entity {
  113. "{storageBagId-distributionBucketId}"
  114. id: ID!
  115. "Storage bag to be distributed"
  116. storageBag: StorageBag!
  117. "Distribution bucket that should distribute the bag"
  118. distributionBucket: DistributionBucket!
  119. # Relationship filtering workaround
  120. storageBagId: ID
  121. distributionBucketId: ID
  122. }
  123. type StorageDataObject @entity {
  124. "Data object runtime id"
  125. id: ID!
  126. "Whether the data object was uploaded and accepted by the storage provider"
  127. isAccepted: Boolean!
  128. "Data object size in bytes"
  129. size: BigInt!
  130. "Storage bag the data object is part of"
  131. storageBag: StorageBag!
  132. "IPFS content hash"
  133. ipfsHash: String!
  134. }
  135. type DistributionBucketFamilyMetadata @entity {
  136. "Name of the geographical region covered by the family (ie.: us-east-1)"
  137. region: String
  138. "Optional, more specific description of the region covered by the family"
  139. description: String
  140. "Optional region boundary as geocoordiantes polygon"
  141. boundary: [GeoCoordinates!] @derivedFrom(field: "boundarySourceBucketFamilyMeta")
  142. }
  143. type DistributionBucketOperatorMetadata @entity {
  144. "Root distributor node api endpoint"
  145. nodeEndpoint: String
  146. "Optional node location metadata"
  147. nodeLocation: NodeLocationMetadata
  148. "Additional information about the node/operator"
  149. extra: String
  150. }
  151. enum DistributionBucketOperatorStatus {
  152. INVITED,
  153. ACTIVE
  154. }
  155. type DistributionBucketOperator @entity {
  156. "{bucketId}-{workerId}"
  157. id: ID!
  158. "Related distirbution bucket"
  159. distributionBucket: DistributionBucket!
  160. "ID of the distribution group worker"
  161. workerId: Int!
  162. "Current operator status"
  163. status: DistributionBucketOperatorStatus!
  164. "Operator metadata"
  165. metadata: DistributionBucketOperatorMetadata
  166. }
  167. type DistributionBucket @entity {
  168. "Runtime bucket id"
  169. id: ID!
  170. "Distribution family the bucket is part of"
  171. family: DistributionBucketFamily!
  172. "Distribution bucket operators (either active or invited)"
  173. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  174. "Whether the bucket is accepting any new bags"
  175. acceptingNewBags: Boolean!
  176. "Whether the bucket is currently distributing content"
  177. distributing: Boolean!
  178. "Assignments to distribute a bag"
  179. bagAssignments: [StorageBagDistributionAssignment!] @derivedFrom(field: "distributionBucket")
  180. }
  181. type DistributionBucketFamily @entity {
  182. "Runtime bucket family id"
  183. id: ID!
  184. "Current bucket family metadata"
  185. metadata: DistributionBucketFamilyMetadata
  186. "Distribution buckets belonging to the family"
  187. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  188. }