storj/satellite/satellitedb/dbx/satellitedb.dbx
Bill Thorp f9845e7e92
changes to masterdb to support accountingDB (#846)
* added rollup to captplanet, moved accountingDB to masterdb
2018-12-14 09:27:21 -05:00

115 lines
2.2 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 = ?
)