storj/satellite/satellitedb/dbx/node_reputation.dbx
Egon Elbre 1688e4965b satellite/satellitedb/dbx: split into multiple files
The current satellitedb.dbx has grown quite big over time.
Split the single file into multiple smaller ones.

Change-Id: I8d6ca851b834ac60820aff565906f04aab661875
2023-01-09 16:24:31 +02:00

53 lines
2.0 KiB
Plaintext

//--- reputation store ---//
model reputation (
key id
field id blob
field audit_success_count int64 ( updatable, default 0 )
field total_audit_count int64 ( updatable, default 0 )
field vetted_at timestamp ( updatable, nullable )
field created_at timestamp ( autoinsert, default current_timestamp )
field updated_at timestamp ( autoinsert, autoupdate, default current_timestamp )
// node is disqualified when it fails too many audits or is offline for too long
field disqualified timestamp ( updatable, nullable )
field disqualification_reason int ( updatable, nullable )
// node is placed under inspection when it has too many unknown-error audits
// renamed column from suspended
field unknown_audit_suspended timestamp ( updatable, nullable )
// node is considered unhealthy if it is offline for too many audits
field offline_suspended timestamp ( updatable, nullable )
// once a node becomes offline_suspended, mark it as under review so we check it again later
field under_review timestamp ( updatable, nullable )
field online_score float64 ( updatable, default 1 )
field audit_history blob ( updatable )
// audit_reputation_fields track information related to successful vs. failed error audits
field audit_reputation_alpha float64 ( updatable, default 1 )
field audit_reputation_beta float64 ( updatable, default 0 )
// unknown_audit_reputation fields track information related to successful vs. unknown error audits
field unknown_audit_reputation_alpha float64 ( updatable, default 1 )
field unknown_audit_reputation_beta float64 ( updatable, default 0 )
)
create reputation ()
update reputation ( where reputation.id = ? )
update reputation (
where reputation.id = ?
where reputation.audit_history = ?
)
update reputation (
where reputation.id = ?
noreturn
)
// "Get" query; fails if reputation not found
read one (
select reputation
where reputation.id = ?
)