2018-12-05 09:35:50 +00:00
|
|
|
// dbx.v1 golang satellitedb.dbx .
|
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
//--- bwagreement ---//
|
|
|
|
|
2018-12-07 09:59:31 +00:00
|
|
|
model bwagreement (
|
2018-12-27 21:21:50 +00:00
|
|
|
key signature
|
2019-01-09 15:02:03 +00:00
|
|
|
unique serialnum
|
2018-12-05 09:35:50 +00:00
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field signature blob
|
2019-01-09 15:02:03 +00:00
|
|
|
field serialnum text
|
2018-12-27 21:21:50 +00:00
|
|
|
field data blob
|
2018-12-07 09:59:31 +00:00
|
|
|
field created_at timestamp ( autoinsert )
|
2019-01-10 18:30:55 +00:00
|
|
|
field expires_at timestamp
|
2018-12-07 09:59:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
create bwagreement ( )
|
|
|
|
delete bwagreement ( where bwagreement.signature = ? )
|
2019-01-10 18:30:55 +00:00
|
|
|
delete bwagreement ( where bwagreement.expires_at <= ?)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-07 09:59:31 +00:00
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select bwagreement
|
|
|
|
where bwagreement.signature = ?
|
2018-12-07 09:59:31 +00:00
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-07 09:59:31 +00:00
|
|
|
read limitoffset (
|
|
|
|
select bwagreement
|
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-07 09:59:31 +00:00
|
|
|
read all (
|
|
|
|
select bwagreement
|
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-07 09:59:31 +00:00
|
|
|
read all (
|
|
|
|
select bwagreement
|
|
|
|
where bwagreement.created_at > ?
|
2018-12-10 19:08:45 +00:00
|
|
|
)
|
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
//--- datarepair.irreparableDB ---//
|
|
|
|
|
2018-12-10 19:08:45 +00:00
|
|
|
model irreparabledb (
|
|
|
|
key segmentpath
|
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
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 )
|
2018-12-10 19:08:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
create irreparabledb ( )
|
|
|
|
update irreparabledb ( where irreparabledb.segmentpath = ? )
|
|
|
|
delete irreparabledb ( where irreparabledb.segmentpath = ? )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-10 19:08:45 +00:00
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select irreparabledb
|
|
|
|
where irreparabledb.segmentpath = ?
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
//--- accounting ---//
|
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
// accounting_timestamps just allows us to save the last time/thing that happened
|
|
|
|
model accounting_timestamps (
|
2018-12-27 21:21:50 +00:00
|
|
|
key name
|
2018-12-14 14:27:21 +00:00
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field name text
|
|
|
|
field value timestamp ( updatable )
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
create accounting_timestamps ( )
|
|
|
|
update accounting_timestamps ( where accounting_timestamps.name = ? )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
read scalar (
|
2018-12-27 21:21:50 +00:00
|
|
|
select accounting_timestamps.value
|
|
|
|
where accounting_timestamps.name = ?
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
model accounting_rollup (
|
2018-12-27 21:21:50 +00:00
|
|
|
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 )
|
2018-12-14 14:27:21 +00:00
|
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
create accounting_rollup ( )
|
|
|
|
update accounting_rollup ( where accounting_rollup.id = ? )
|
|
|
|
delete accounting_rollup ( where accounting_rollup.id = ? )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select accounting_rollup
|
|
|
|
where accounting_rollup.id = ?
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
read all (
|
2018-12-27 21:21:50 +00:00
|
|
|
select accounting_rollup
|
|
|
|
where accounting_rollup.node_id = ?
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
model accounting_raw (
|
2018-12-27 21:21:50 +00:00
|
|
|
key id
|
2018-12-14 14:27:21 +00:00
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
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 )
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
create accounting_raw ( )
|
|
|
|
update accounting_raw ( where accounting_raw.id = ? )
|
|
|
|
delete accounting_raw ( where accounting_raw.id = ? )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select accounting_raw
|
|
|
|
where accounting_raw.id = ?
|
2018-12-14 14:27:21 +00:00
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
read all (
|
2018-12-27 21:21:50 +00:00
|
|
|
select accounting_raw
|
|
|
|
where accounting_raw.node_id = ?
|
2018-12-14 20:17:30 +00:00
|
|
|
)
|
2018-12-18 17:18:42 +00:00
|
|
|
|
|
|
|
//--- statdb ---//
|
|
|
|
|
2018-12-14 20:17:30 +00:00
|
|
|
model node (
|
|
|
|
key id
|
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field id blob
|
|
|
|
field audit_success_count int64 ( updatable )
|
|
|
|
field total_audit_count int64 ( updatable )
|
|
|
|
field audit_success_ratio float64 ( updatable )
|
2018-12-14 20:17:30 +00:00
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field uptime_success_count int64 ( updatable )
|
|
|
|
field total_uptime_count int64 ( updatable )
|
|
|
|
field uptime_ratio float64 ( updatable )
|
2018-12-14 20:17:30 +00:00
|
|
|
|
|
|
|
field created_at timestamp ( autoinsert )
|
|
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
|
|
|
create node ( )
|
|
|
|
update node ( where node.id = ? )
|
|
|
|
delete node ( where node.id = ? )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-14 20:17:30 +00:00
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select node
|
|
|
|
where node.id = ?
|
2018-12-14 20:17:30 +00:00
|
|
|
)
|
2018-12-17 20:14:16 +00:00
|
|
|
|
|
|
|
//--- overlaycache ---//
|
|
|
|
|
|
|
|
model overlay_cache_node (
|
2018-12-27 21:21:50 +00:00
|
|
|
key key
|
2018-12-17 20:14:16 +00:00
|
|
|
unique key
|
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field key blob
|
|
|
|
field value blob ( updatable )
|
2018-12-17 20:14:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
create overlay_cache_node ( )
|
|
|
|
|
|
|
|
read one (
|
2018-12-27 21:21:50 +00:00
|
|
|
select overlay_cache_node
|
|
|
|
where overlay_cache_node.key = ?
|
2018-12-17 20:14:16 +00:00
|
|
|
)
|
|
|
|
|
2018-12-18 20:41:31 +00:00
|
|
|
read limitoffset (
|
|
|
|
select overlay_cache_node
|
|
|
|
)
|
|
|
|
|
2018-12-17 20:14:16 +00:00
|
|
|
read limitoffset (
|
|
|
|
select overlay_cache_node
|
2018-12-27 21:21:50 +00:00
|
|
|
where overlay_cache_node.key >= ?
|
2018-12-17 20:14:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
update overlay_cache_node ( where overlay_cache_node.key = ? )
|
2018-12-21 15:11:19 +00:00
|
|
|
delete overlay_cache_node ( where overlay_cache_node.key = ? )
|
|
|
|
|
|
|
|
//--- repairqueue ---//
|
|
|
|
|
|
|
|
model injuredsegment (
|
2018-12-27 21:21:50 +00:00
|
|
|
key id
|
2018-12-21 15:11:19 +00:00
|
|
|
|
2018-12-27 21:21:50 +00:00
|
|
|
field id serial64
|
2018-12-21 15:11:19 +00:00
|
|
|
field info blob
|
|
|
|
)
|
|
|
|
|
|
|
|
create injuredsegment ( )
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-21 15:11:19 +00:00
|
|
|
read first (
|
|
|
|
select injuredsegment
|
|
|
|
)
|
2018-12-27 21:21:50 +00:00
|
|
|
|
2018-12-21 15:11:19 +00:00
|
|
|
read limitoffset (
|
|
|
|
select injuredsegment
|
|
|
|
)
|
2018-12-27 09:56:25 +00:00
|
|
|
delete injuredsegment ( where injuredsegment.id = ? )
|