110 lines
2.5 KiB
Plaintext
110 lines
2.5 KiB
Plaintext
|
//--- metainfo buckets ---//
|
||
|
|
||
|
model bucket_metainfo (
|
||
|
key id
|
||
|
unique project_id name
|
||
|
|
||
|
field id blob
|
||
|
field project_id project.id restrict
|
||
|
field name blob
|
||
|
field partner_id blob (nullable, updatable)
|
||
|
field user_agent blob (nullable, updatable)
|
||
|
|
||
|
field path_cipher int
|
||
|
|
||
|
field created_at timestamp ( autoinsert )
|
||
|
|
||
|
field default_segment_size int (updatable)
|
||
|
|
||
|
field default_encryption_cipher_suite int (updatable)
|
||
|
field default_encryption_block_size int (updatable)
|
||
|
|
||
|
field default_redundancy_algorithm int (updatable)
|
||
|
field default_redundancy_share_size int (updatable)
|
||
|
field default_redundancy_required_shares int (updatable)
|
||
|
field default_redundancy_repair_shares int (updatable)
|
||
|
field default_redundancy_optimal_shares int (updatable)
|
||
|
field default_redundancy_total_shares int (updatable)
|
||
|
|
||
|
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 = ?
|
||
|
)
|
||
|
|
||
|
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 = ?
|
||
|
)
|
||
|
|
||
|
//--- Value Attribution ---//
|
||
|
model value_attribution (
|
||
|
key project_id bucket_name
|
||
|
|
||
|
field project_id blob
|
||
|
field bucket_name blob
|
||
|
field partner_id blob
|
||
|
field user_agent blob ( nullable )
|
||
|
field last_updated timestamp ( autoinsert, autoupdate )
|
||
|
)
|
||
|
|
||
|
create value_attribution ()
|
||
|
|
||
|
read one (
|
||
|
select value_attribution
|
||
|
where value_attribution.project_id = ?
|
||
|
where value_attribution.bucket_name = ?
|
||
|
)
|