storage.graphql 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. }
  107. type StorageBagDistributionAssignment @entity {
  108. "{storageBagId-distributionBucketId}"
  109. id: ID!
  110. "Storage bag to be distributed"
  111. storageBag: StorageBag!
  112. "Distribution bucket that should distribute the bag"
  113. distributionBucket: DistributionBucket!
  114. }
  115. type StorageDataObject @entity {
  116. "Data object runtime id"
  117. id: ID!
  118. "Whether the data object was uploaded and accepted by the storage provider"
  119. isAccepted: Boolean!
  120. "Data object size in bytes"
  121. size: BigInt!
  122. "Storage bag the data object is part of"
  123. storageBag: StorageBag!
  124. "IPFS content hash"
  125. ipfsHash: String!
  126. }
  127. type DistributionBucketFamilyMetadata @entity {
  128. "Name of the geographical region covered by the family (ie.: us-east-1)"
  129. region: String
  130. "Optional, more specific description of the region covered by the family"
  131. description: String
  132. "Optional region boundary as geocoordiantes polygon"
  133. boundary: [GeoCoordinates!] @derivedFrom(field: "boundarySourceBucketFamilyMeta")
  134. }
  135. type DistributionBucketOperatorMetadata @entity {
  136. "Root distributor node api endpoint"
  137. nodeEndpoint: String
  138. "Optional node location metadata"
  139. nodeLocation: NodeLocationMetadata
  140. "Additional information about the node/operator"
  141. extra: String
  142. }
  143. enum DistributionBucketOperatorStatus {
  144. INVITED,
  145. ACTIVE
  146. }
  147. type DistributionBucketOperator @entity {
  148. "{bucketId}-{workerId}"
  149. id: ID!
  150. "Related distirbution bucket"
  151. distributionBucket: DistributionBucket!
  152. "ID of the distribution group worker"
  153. workerId: Int!
  154. "Current operator status"
  155. status: DistributionBucketOperatorStatus!
  156. "Operator metadata"
  157. metadata: DistributionBucketOperatorMetadata
  158. }
  159. type DistributionBucket @entity {
  160. "Runtime bucket id"
  161. id: ID!
  162. "Distribution family the bucket is part of"
  163. family: DistributionBucketFamily!
  164. "Distribution bucket operators (either active or invited)"
  165. operators: [DistributionBucketOperator!] @derivedFrom(field: "distributionBucket")
  166. "Whether the bucket is accepting any new bags"
  167. acceptingNewBags: Boolean!
  168. "Whether the bucket is currently distributing content"
  169. distributing: Boolean!
  170. "Assignments to distribute a bag"
  171. bagAssignments: [StorageBagDistributionAssignment!] @derivedFrom(field: "distributionBucket")
  172. }
  173. type DistributionBucketFamily @entity {
  174. "Runtime bucket family id"
  175. id: ID!
  176. "Current bucket family metadata"
  177. metadata: DistributionBucketFamilyMetadata
  178. "Distribution buckets belonging to the family"
  179. buckets: [DistributionBucket!] @derivedFrom(field: "family")
  180. }