storj/satellite/satellitedb/dbx/satellitedb.dbx
Michal Niewrzal a819d819e3
Overlay Cache master db merge (#877)
* Overlay Cache master db merge

* test update

* review comments

* Fix transaction usage

* removed unused variable

* added better limit handling

* better error handling
2018-12-17 21:14:16 +01:00

164 lines
3.1 KiB
Plaintext

// dbx.v1 golang satellitedb.dbx .
//--- bwagreement ---//
model bwagreement (
key signature
field signature blob
field data blob
field created_at timestamp ( autoinsert )
)
create bwagreement ( )
delete bwagreement ( where bwagreement.signature = ? )
read one (
select bwagreement
where bwagreement.signature = ?
)
read limitoffset (
select bwagreement
)
read all (
select bwagreement
)
read all (
select bwagreement
where bwagreement.created_at > ?
)
//--- datarepair.irreparableDB ---//
model irreparabledb (
key segmentpath
field segmentpath blob
field segmentdetail blob (updatable)
field pieces_lost_count int64 (updatable)
field seg_damaged_unix_sec int64 (updatable)
field repair_attempt_count int64 (updatable)
)
create irreparabledb ( )
update irreparabledb ( where irreparabledb.segmentpath = ? )
delete irreparabledb ( where irreparabledb.segmentpath = ? )
read one (
select irreparabledb
where irreparabledb.segmentpath = ?
)
//--- accounting ---//
// timestamps just allows us to save the last time/thing that happened
model timestamps (
key name
field name text
field value timestamp ( updatable )
)
create timestamps ( )
update timestamps ( where timestamps.name = ? )
read scalar (
select timestamps.value
where timestamps.name = ?
)
model rollup (
key id
field id serial64
field node_id text
field start_time timestamp
field interval int64
field data_type int
field created_at timestamp ( autoinsert )
field updated_at timestamp ( autoinsert, autoupdate )
)
create rollup ( )
update rollup ( where rollup.id = ? )
delete rollup ( where rollup.id = ? )
read one (
select rollup
where rollup.id = ?
)
read all (
select rollup
where rollup.node_id = ?
)
model raw (
key id
field id serial64
field node_id text
field interval_end_time timestamp
field data_total int64
field data_type int
field created_at timestamp ( autoinsert )
field updated_at timestamp ( autoinsert, autoupdate )
)
create raw ( )
update raw ( where raw.id = ? )
delete raw ( where raw.id = ? )
read one (
select raw
where raw.id = ?
)
read all (
select raw
where raw.node_id = ?
)
// dbx.v1 golang statdb.dbx .
model node (
key id
field id blob
field audit_success_count int64 (updatable)
field total_audit_count int64 (updatable)
field audit_success_ratio float64 (updatable)
field uptime_success_count int64 (updatable)
field total_uptime_count int64 (updatable)
field uptime_ratio float64 (updatable)
field created_at timestamp ( autoinsert )
field updated_at timestamp ( autoinsert, autoupdate )
)
create node ( )
update node ( where node.id = ? )
delete node ( where node.id = ? )
read one (
select node
where node.id = ?
)
//--- overlaycache ---//
model overlay_cache_node (
key key
unique key
field key blob
field value blob (updatable)
)
create overlay_cache_node ( )
read one (
select overlay_cache_node
where overlay_cache_node.key = ?
)
read limitoffset (
select overlay_cache_node
where overlay_cache_node.key >= ?
)
update overlay_cache_node ( where overlay_cache_node.key = ? )
delete overlay_cache_node ( where overlay_cache_node.key = ? )