storj/storagenode/reputation/reputation.go
Moby von Briesen 14b3704f56 storagenode: add suspended status to storagenode dashboard/api
* Add migration to storagenode reputation table to add suspended
timestamp
* Send suspended info to storagenode from satellite nodestats endpoint
* Add suspended status to storagenode api
* Add an indicator on the storagenode dashboard informing operator of
the satellites the node is suspended on

Change-Id: Ie3669f6069cc0258ba76ec99d17006e1b5fd9c8a
2020-04-09 13:36:23 +00:00

47 lines
986 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package reputation
import (
"context"
"time"
"storj.io/common/storj"
)
// DB works with reputation database
//
// architecture: Database
type DB interface {
// Store inserts or updates reputation stats into the DB
Store(ctx context.Context, stats Stats) error
// Get retrieves stats for specific satellite
Get(ctx context.Context, satelliteID storj.NodeID) (*Stats, error)
// All retrieves all stats from DB
All(ctx context.Context) ([]Stats, error)
}
// Stats consist of reputation metrics
type Stats struct {
SatelliteID storj.NodeID
Uptime Metric
Audit Metric
Disqualified *time.Time
Suspended *time.Time
UpdatedAt time.Time
}
// Metric encapsulates storagenode reputation metrics
type Metric struct {
TotalCount int64 `json:"totalCount"`
SuccessCount int64 `json:"successCount"`
Alpha float64 `json:"alpha"`
Beta float64 `json:"beta"`
Score float64 `json:"score"`
}