2022-10-25 11:47:34 +01:00
|
|
|
// bucket_metainfo contains information about a bucket in a project.
|
2023-01-06 16:27:42 +00:00
|
|
|
model bucket_metainfo (
|
|
|
|
key id
|
|
|
|
unique project_id name
|
|
|
|
|
2023-01-10 16:02:56 +00:00
|
|
|
// id is an UUID for the bucket.
|
2023-01-06 16:27:42 +00:00
|
|
|
field id blob
|
2022-10-25 11:47:34 +01:00
|
|
|
// project_id is the project the bucket belongs to.
|
2023-01-06 16:27:42 +00:00
|
|
|
field project_id project.id restrict
|
2022-10-25 11:47:34 +01:00
|
|
|
// name is a unique name inside the project.
|
|
|
|
// it's a alphanumeric string similar to domain names.
|
2023-01-06 16:27:42 +00:00
|
|
|
field name blob
|
2022-10-25 11:47:34 +01:00
|
|
|
// user_agent is the first User-Agent that was used to upload data,
|
|
|
|
// unless the user signed up with a specific partner.
|
|
|
|
// note: this field is duplicated in value_attribution.user_agent.
|
2023-01-06 16:27:42 +00:00
|
|
|
field user_agent blob (nullable, updatable)
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// path_cipher is denotes how the paths have been encoded.
|
|
|
|
// The corresponding type storj.CipherSuite contains the relevant values.
|
|
|
|
// deprecated: in favor of a storing it in an access grant.
|
2023-01-06 16:27:42 +00:00
|
|
|
field path_cipher int
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// created_at indicates when the bucket was created.
|
2023-01-06 16:27:42 +00:00
|
|
|
field created_at timestamp ( autoinsert )
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_segment_size contains the segment size to use for uploading.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_segment_size int (updatable)
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_encryption_cipher_suite is the storj.CipherSuite used for the bucket objects.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_encryption_cipher_suite int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_encryption_block_size is the block size argument for encryption.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_encryption_block_size int (updatable)
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_algorithm is storj.RedundancyAlgorithm.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_algorithm int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_share_size is share size parameter for Reed-Solomon encoding.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_share_size int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_required_shares is required shares parameter for Reed-Solomon encoding.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_required_shares int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_repair_shares is repair threshold parameter for Reed-Solomon encoding.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_repair_shares int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_optimal_shares is optional share count parameter for Reed-Solomon encoding.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_optimal_shares int (updatable)
|
2022-10-25 11:47:34 +01:00
|
|
|
// default_redundancy_total_shares is total number of shares for Reed-Solomon encoding.
|
|
|
|
// deprecated: in favor of global metainfo service settings.
|
2023-01-06 16:27:42 +00:00
|
|
|
field default_redundancy_total_shares int (updatable)
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// placement indicates how the objects should be stored in this bucket.
|
|
|
|
// See storj.PlacementConstraint for the relevant information:
|
|
|
|
// 0 - every country
|
|
|
|
// 1 - EU
|
|
|
|
// 2 - EEA
|
|
|
|
// 3 - US
|
|
|
|
// 4 - DE
|
|
|
|
// 5 - Invalid, when there's no information about the placement.
|
2023-05-24 15:59:47 +01:00
|
|
|
// 6 - NR (no Russia, Belarus or other sanctioned country)
|
2023-01-06 16:27:42 +00:00
|
|
|
field placement int (nullable, updatable)
|
|
|
|
)
|
|
|
|
|
|
|
|
create bucket_metainfo ()
|
|
|
|
update bucket_metainfo (
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select bucket_metainfo
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select bucket_metainfo.created_at
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select bucket_metainfo.id
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select bucket_metainfo.placement
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
2023-01-27 05:34:08 +00:00
|
|
|
read one (
|
|
|
|
select bucket_metainfo.user_agent
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
2023-01-06 16:27:42 +00:00
|
|
|
read has (
|
|
|
|
select bucket_metainfo
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
delete bucket_metainfo (
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
read limitoffset ( // Forward
|
|
|
|
select bucket_metainfo
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name >= ?
|
|
|
|
orderby asc bucket_metainfo.name
|
|
|
|
)
|
|
|
|
|
|
|
|
read limitoffset ( // After
|
|
|
|
select bucket_metainfo
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
where bucket_metainfo.name > ?
|
|
|
|
orderby asc bucket_metainfo.name
|
|
|
|
)
|
|
|
|
|
|
|
|
read count (
|
|
|
|
select bucket_metainfo.name
|
|
|
|
where bucket_metainfo.project_id = ?
|
|
|
|
)
|
|
|
|
|
2022-10-25 11:47:34 +01:00
|
|
|
// value_attribution table contains information about which user-agent
|
|
|
|
// is used to create the project. It's being stored outside of the projects
|
|
|
|
// table because this information can be still needed after deleting the
|
|
|
|
// project.
|
2023-01-06 16:27:42 +00:00
|
|
|
model value_attribution (
|
|
|
|
key project_id bucket_name
|
|
|
|
|
2023-01-10 16:02:56 +00:00
|
|
|
// project_id is an UUID that refers to project.id.
|
2022-10-25 11:47:34 +01:00
|
|
|
// note: this field is duplicated in bucket_metainfo.project_id.
|
2023-01-06 16:27:42 +00:00
|
|
|
field project_id blob
|
2022-10-25 11:47:34 +01:00
|
|
|
// bucket_name refers to bucket_metainfo.name.
|
|
|
|
// This does not use the id, because we need the attribution to last
|
|
|
|
// beyond the lifetime of bucket_metainfo row.
|
2023-01-06 16:27:42 +00:00
|
|
|
field bucket_name blob
|
2022-10-25 11:47:34 +01:00
|
|
|
// user_agent is the first User-Agent that was used to upload data.
|
|
|
|
// unless the user signed up with a specific partner.
|
|
|
|
// note: this field is duplicated in bucket_metainfo.user_agent.
|
2023-06-13 16:58:24 +01:00
|
|
|
field user_agent blob ( updatable, nullable )
|
2023-05-31 22:02:30 +01:00
|
|
|
// TODO remove as part of release 1.81 or after
|
|
|
|
field partner_id blob (nullable, default null)
|
2022-10-25 11:47:34 +01:00
|
|
|
// last_updated is updated whenever the row changes.
|
2023-01-06 16:27:42 +00:00
|
|
|
field last_updated timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
|
|
|
create value_attribution ()
|
2023-06-13 16:58:24 +01:00
|
|
|
update value_attribution (
|
|
|
|
where value_attribution.project_id = ?
|
|
|
|
where value_attribution.bucket_name = ?
|
|
|
|
)
|
2023-01-06 16:27:42 +00:00
|
|
|
|
|
|
|
read one (
|
|
|
|
select value_attribution
|
|
|
|
where value_attribution.project_id = ?
|
|
|
|
where value_attribution.bucket_name = ?
|
|
|
|
)
|