Documentation ¶
Index ¶
- Variables
- type AmountPeriod
- type Client
- type DB
- type Endpoint
- func (endpoint *Endpoint) GetAllPayments(ctx context.Context, satelliteID storj.NodeID) (_ []Payment, err error)
- func (endpoint *Endpoint) GetAllPaystubs(ctx context.Context, satelliteID storj.NodeID) (_ []PayStub, err error)
- func (endpoint *Endpoint) GetPayment(ctx context.Context, satelliteID storj.NodeID, period string) (_ *Payment, err error)
- func (endpoint *Endpoint) GetPaystub(ctx context.Context, satelliteID storj.NodeID, period string) (_ *PayStub, err error)
- type EstimatedPayout
- type HeldHistory
- type PayStub
- type Payment
- type PayoutHistory
- type PayoutMonthly
- type Service
- func (service *Service) AllHeldbackHistory(ctx context.Context) (result []HeldHistory, err error)
- func (service *Service) AllPayStubsMonthly(ctx context.Context, period string) (payStubs []PayStub, err error)
- func (service *Service) AllPayStubsPeriod(ctx context.Context, periodStart, periodEnd string) (payStubs []PayStub, err error)
- func (service *Service) AllPeriods(ctx context.Context) (_ []string, err error)
- func (service *Service) PayoutHistoryMonthly(ctx context.Context, period string) (result []PayoutHistory, err error)
- func (service *Service) SatellitePayStubMonthly(ctx context.Context, satelliteID storj.NodeID, period string) (payStub *PayStub, err error)
- func (service *Service) SatellitePayStubPeriod(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payStubs []PayStub, err error)
- func (service *Service) SatellitePeriods(ctx context.Context, satelliteID storj.NodeID) (_ []string, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHeldAmountService defines held amount service error. ErrHeldAmountService = errs.Class("heldamount service error") // ErrBadPeriod defines that period has wrong format. ErrBadPeriod = errs.Class("wrong period format") )
var ErrNoPayStubForPeriod = errs.Class("no payStub for period error")
ErrNoPayStubForPeriod represents errors from the heldamount database.
Functions ¶
This section is empty.
Types ¶
type AmountPeriod ¶ added in v1.6.1
AmountPeriod is node's held amount for period.
type Client ¶
type Client struct { pb.DRPCHeldAmountClient // contains filtered or unexported fields }
Client encapsulates HeldAmountClient with underlying connection.
architecture: Client
type DB ¶
type DB interface { // StorePayStub inserts or updates held amount into the DB StorePayStub(ctx context.Context, paystub PayStub) error // GetPayStub retrieves paystub stats for specific satellite GetPayStub(ctx context.Context, satelliteID storj.NodeID, period string) (*PayStub, error) // AllPayStubs retrieves paystub data from all satellites in specific period from DB. AllPayStubs(ctx context.Context, period string) ([]PayStub, error) // SatellitesHeldbackHistory retrieves heldback history for specific satellite from DB. SatellitesHeldbackHistory(ctx context.Context, satelliteID storj.NodeID) ([]AmountPeriod, error) // SatellitesDisposedHistory returns all disposed amount for specific satellite from DB. SatellitesDisposedHistory(ctx context.Context, satelliteID storj.NodeID) (int64, error) // SatellitePeriods retrieves all periods for concrete satellite in which we have some heldamount data. SatellitePeriods(ctx context.Context, satelliteID storj.NodeID) ([]string, error) // AllPeriods retrieves all periods in which we have some heldamount data. AllPeriods(ctx context.Context) ([]string, error) // StorePayment inserts or updates payment into the DB StorePayment(ctx context.Context, payment Payment) error }
DB works with heldamount database
architecture: Database
type Endpoint ¶ added in v1.8.1
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint retrieves info from satellites using an rpc client.
architecture: Endpoint
func NewEndpoint ¶ added in v1.8.1
NewEndpoint creates new instance of endpoint.
func (*Endpoint) GetAllPayments ¶ added in v1.8.1
func (endpoint *Endpoint) GetAllPayments(ctx context.Context, satelliteID storj.NodeID) (_ []Payment, err error)
GetAllPayments retrieves all payments for particular satellite.
func (*Endpoint) GetAllPaystubs ¶ added in v1.8.1
func (endpoint *Endpoint) GetAllPaystubs(ctx context.Context, satelliteID storj.NodeID) (_ []PayStub, err error)
GetAllPaystubs retrieves all paystubs for particular satellite.
type EstimatedPayout ¶ added in v1.6.1
type EstimatedPayout struct { CurrentMonth PayoutMonthly `json:"currentMonth"` PreviousMonth PayoutMonthly `json:"previousMonth"` }
EstimatedPayout contains usage and estimated payout data for current and previous months.
type HeldHistory ¶ added in v1.6.1
type HeldHistory struct { SatelliteID storj.NodeID `json:"satelliteID"` SatelliteName string `json:"satelliteName"` Age int64 `json:"age"` FirstPeriod int64 `json:"firstPeriod"` SecondPeriod int64 `json:"secondPeriod"` ThirdPeriod int64 `json:"thirdPeriod"` TotalHeld int64 `json:"totalHeld"` TotalDisposed int64 `json:"totalDisposed"` JoinedAt time.Time `json:"joinedAt"` }
HeldHistory amount of held for specific percent rate period.
type PayStub ¶
type PayStub struct { SatelliteID storj.NodeID `json:"satelliteId"` Period string `json:"period"` Created time.Time `json:"created"` Codes string `json:"codes"` UsageAtRest float64 `json:"usageAtRest"` UsageGet int64 `json:"usageGet"` UsagePut int64 `json:"usagePut"` UsageGetRepair int64 `json:"usageGetRepair"` UsagePutRepair int64 `json:"usagePutRepair"` UsageGetAudit int64 `json:"usageGetAudit"` CompAtRest int64 `json:"compAtRest"` CompGet int64 `json:"compGet"` CompPut int64 `json:"compPut"` CompGetRepair int64 `json:"compGetRepair"` CompPutRepair int64 `json:"compPutRepair"` CompGetAudit int64 `json:"compGetAudit"` SurgePercent int64 `json:"surgePercent"` Held int64 `json:"held"` Owed int64 `json:"owed"` Disposed int64 `json:"disposed"` Paid int64 `json:"paid"` Receipt string `json:"receipt"` }
PayStub is node heldamount data for satellite by specific period.
func (*PayStub) UsageAtRestTbM ¶ added in v1.9.1
func (paystub *PayStub) UsageAtRestTbM()
UsageAtRestTbM converts paystub's usage_at_rest from tbh to tbm.
type Payment ¶
type Payment struct { ID int64 `json:"id"` Created time.Time `json:"created"` SatelliteID storj.NodeID `json:"satelliteId"` Period string `json:"period"` Amount int64 `json:"amount"` Receipt string `json:"receipt"` Notes string `json:"notes"` }
Payment is node payment data for specific period.
type PayoutHistory ¶ added in v1.9.1
type PayoutHistory struct { NodeAge int64 `json:"nodeAge"` Earned int64 `json:"earned"` Surge int64 `json:"surge"` Held int64 `json:"held"` AfterHeld int64 `json:"afterHeld"` HeldReturned int64 `json:"heldReturned"` Receipt string `json:"receipt"` IsExitComplete bool `json:"isExitComplete"` }
PayoutHistory contains payout information for specific period for specific satellite.
type PayoutMonthly ¶ added in v1.6.1
type PayoutMonthly struct { EgressBandwidth int64 `json:"egressBandwidth"` EgressBandwidthPayout int64 `json:"egressBandwidthPayout"` EgressRepairAudit int64 `json:"egressRepairAudit"` EgressRepairAuditPayout int64 `json:"egressRepairAuditPayout"` DiskSpace float64 `json:"diskSpace"` DiskSpacePayout int64 `json:"diskSpacePayout"` HeldRate int64 `json:"heldRate"` Payout int64 `json:"payout"` Held int64 `json:"held"` }
PayoutMonthly contains usage and estimated payout date.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service retrieves info from satellites using an rpc client
architecture: Service
func NewService ¶
func NewService(log *zap.Logger, db DB, reputationDB reputation.DB, satelliteDB satellites.DB, trust *trust.Pool) *Service
NewService creates new instance of service.
func (*Service) AllHeldbackHistory ¶ added in v1.5.2
func (service *Service) AllHeldbackHistory(ctx context.Context) (result []HeldHistory, err error)
AllHeldbackHistory retrieves heldback history for all satellites from storagenode database.
func (*Service) AllPayStubsMonthly ¶ added in v1.8.1
func (service *Service) AllPayStubsMonthly(ctx context.Context, period string) (payStubs []PayStub, err error)
AllPayStubsMonthly retrieves held amount for all satellites per selected period from storagenode database.
func (*Service) AllPayStubsPeriod ¶ added in v1.8.1
func (service *Service) AllPayStubsPeriod(ctx context.Context, periodStart, periodEnd string) (payStubs []PayStub, err error)
AllPayStubsPeriod retrieves held amount for all satellites for selected range of months from storagenode database.
func (*Service) AllPeriods ¶ added in v1.6.1
AllPeriods retrieves all periods in which we have some heldamount data.
func (*Service) PayoutHistoryMonthly ¶ added in v1.9.1
func (service *Service) PayoutHistoryMonthly(ctx context.Context, period string) (result []PayoutHistory, err error)
PayoutHistoryMonthly retrieves paystub and payment receipt for specific month from all satellites.
func (*Service) SatellitePayStubMonthly ¶ added in v1.8.1
func (service *Service) SatellitePayStubMonthly(ctx context.Context, satelliteID storj.NodeID, period string) (payStub *PayStub, err error)
SatellitePayStubMonthly retrieves held amount for particular satellite for selected month from storagenode database.
func (*Service) SatellitePayStubPeriod ¶ added in v1.8.1
func (service *Service) SatellitePayStubPeriod(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payStubs []PayStub, err error)
SatellitePayStubPeriod retrieves held amount for all satellites for selected months from storagenode database.