storage.graphql 6.2 KB

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