165 lines
3.4 KiB
Plaintext
165 lines
3.4 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 ---//
|
|
|
|
// accounting_timestamps just allows us to save the last time/thing that happened
|
|
model accounting_timestamps (
|
|
key name
|
|
|
|
field name text
|
|
field value timestamp ( updatable )
|
|
)
|
|
create accounting_timestamps ( )
|
|
update accounting_timestamps ( where accounting_timestamps.name = ? )
|
|
read scalar (
|
|
select accounting_timestamps.value
|
|
where accounting_timestamps.name = ?
|
|
)
|
|
|
|
model accounting_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 accounting_rollup ( )
|
|
update accounting_rollup ( where accounting_rollup.id = ? )
|
|
delete accounting_rollup ( where accounting_rollup.id = ? )
|
|
read one (
|
|
select accounting_rollup
|
|
where accounting_rollup.id = ?
|
|
)
|
|
read all (
|
|
select accounting_rollup
|
|
where accounting_rollup.node_id = ?
|
|
)
|
|
|
|
model accounting_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 accounting_raw ( )
|
|
update accounting_raw ( where accounting_raw.id = ? )
|
|
delete accounting_raw ( where accounting_raw.id = ? )
|
|
read one (
|
|
select accounting_raw
|
|
where accounting_raw.id = ?
|
|
)
|
|
read all (
|
|
select accounting_raw
|
|
where accounting_raw.node_id = ?
|
|
)
|
|
|
|
//--- statdb ---//
|
|
|
|
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 = ? ) |