2023-02-10 14:17:18 +00:00
|
|
|
// reputation stores information about the storagenode reliability and their audit status.
|
2023-01-06 16:27:42 +00:00
|
|
|
model reputation (
|
|
|
|
key id
|
|
|
|
|
2023-02-10 14:17:18 +00:00
|
|
|
// id is the storj.NodeID.
|
2023-01-06 16:27:42 +00:00
|
|
|
field id blob
|
|
|
|
|
2023-02-10 14:17:18 +00:00
|
|
|
// audit_success_count is the total number of audits the node has passed.
|
2023-01-06 16:27:42 +00:00
|
|
|
field audit_success_count int64 ( updatable, default 0 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// total_audit_count is the total number of audits the node has been sent.
|
2023-01-06 16:27:42 +00:00
|
|
|
field total_audit_count int64 ( updatable, default 0 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// vetted_at is the time when the node became a reliable member of the network.
|
2023-01-06 16:27:42 +00:00
|
|
|
field vetted_at timestamp ( updatable, nullable )
|
|
|
|
|
2023-02-10 14:17:18 +00:00
|
|
|
// created_at is the time when tracking of the node started.
|
2023-01-06 16:27:42 +00:00
|
|
|
field created_at timestamp ( autoinsert, default current_timestamp )
|
2023-02-10 14:17:18 +00:00
|
|
|
// updated_at is the time when the reputation was last updated.
|
2023-01-06 16:27:42 +00:00
|
|
|
field updated_at timestamp ( autoinsert, autoupdate, default current_timestamp )
|
|
|
|
|
2023-02-10 14:17:18 +00:00
|
|
|
// disqualified is set when the node fails too many audits or is offline for too long.
|
2023-01-06 16:27:42 +00:00
|
|
|
field disqualified timestamp ( updatable, nullable )
|
2023-02-10 14:17:18 +00:00
|
|
|
// disqualification_reason contains information about why the node was disqualified.
|
|
|
|
// This corresponds to overlay.DisqualificationReason.
|
|
|
|
// 0=unknown, 1=audit failures, 2=suspended for too long, 3=offline for too long.
|
2023-01-06 16:27:42 +00:00
|
|
|
field disqualification_reason int ( updatable, nullable )
|
2023-02-10 14:17:18 +00:00
|
|
|
|
|
|
|
// unknown_audit_suspended is set when the node is placed under inspection.
|
|
|
|
// This happens when it has too many unknown-error audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
field unknown_audit_suspended timestamp ( updatable, nullable )
|
2023-02-10 14:17:18 +00:00
|
|
|
// offline_suspended is set when the node is offline for too many audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
field offline_suspended timestamp ( updatable, nullable )
|
2023-02-10 14:17:18 +00:00
|
|
|
// under_review is set when the node is marked for offline, this marks the node for review
|
|
|
|
// so it can be checked later.
|
2023-01-06 16:27:42 +00:00
|
|
|
field under_review timestamp ( updatable, nullable )
|
2023-02-10 14:17:18 +00:00
|
|
|
// online_score is the summarizing value for the node status.
|
|
|
|
// See storage-node-downtime-tracking-with-audits blueprint for details.
|
2023-01-06 16:27:42 +00:00
|
|
|
field online_score float64 ( updatable, default 1 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// audit_history contains protobuf encoded AuditWindow-s for historic purposes.
|
|
|
|
// See reputation/audithistory.go for details.
|
2023-01-06 16:27:42 +00:00
|
|
|
field audit_history blob ( updatable )
|
|
|
|
|
2023-02-10 14:17:18 +00:00
|
|
|
// audit_reputation_alpha tracks information related to successful vs. failed error audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
field audit_reputation_alpha float64 ( updatable, default 1 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// audit_reputation_beta tracks information related to successful vs. failed error audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
field audit_reputation_beta float64 ( updatable, default 0 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// unknown_audit_reputation_alpha tracks information related to successful vs. unknown error audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
field unknown_audit_reputation_alpha float64 ( updatable, default 1 )
|
2023-02-10 14:17:18 +00:00
|
|
|
// unknown_audit_reputation_beta tracks information related to successful vs. unknown error audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
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 = ?
|
|
|
|
)
|