Documentation ¶
Index ¶
- Variables
- type Client
- type DB
- type PayStub
- type Payment
- type Service
- func (service *Service) AllPayStubsMonthlyCached(ctx context.Context, period string) (payStubs []PayStub, err error)
- func (service *Service) AllPayStubsPeriodCached(ctx context.Context, periodStart, periodEnd string) (payStubs []PayStub, err error)
- func (service *Service) AllPaymentsMonthlyCached(ctx context.Context, period string) (payments []Payment, err error)
- func (service *Service) AllPaymentsPeriodCached(ctx context.Context, periodStart, periodEnd string) (payments []Payment, err error)
- func (service *Service) GetPayment(ctx context.Context, satelliteID storj.NodeID, period string) (_ *Payment, err error)
- func (service *Service) GetPaystubStats(ctx context.Context, satelliteID storj.NodeID, period string) (_ *PayStub, err error)
- func (service *Service) SatellitePayStubMonthlyCached(ctx context.Context, satelliteID storj.NodeID, period string) (payStub *PayStub, err error)
- func (service *Service) SatellitePayStubPeriodCached(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payStubs []PayStub, err error)
- func (service *Service) SatellitePaymentMonthlyCached(ctx context.Context, satelliteID storj.NodeID, period string) (_ *Payment, err error)
- func (service *Service) SatellitePaymentPeriodCached(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payments []*Payment, 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 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) // StorePayment inserts or updates payment into the DB StorePayment(ctx context.Context, payment Payment) error // GetPayment retrieves payment stats for specific satellite in specific period. GetPayment(ctx context.Context, satelliteID storj.NodeID, period string) (*Payment, error) // AllPayments retrieves payment stats from all satellites in specific period from DB. AllPayments(ctx context.Context, period string) ([]Payment, error) }
DB works with heldamount database
architecture: Database
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"` }
PayStub is node heldamount data for satellite by specific period.
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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service retrieves info from satellites using an rpc client
architecture: Service
func NewService ¶
NewService creates new instance of service
func (*Service) AllPayStubsMonthlyCached ¶
func (service *Service) AllPayStubsMonthlyCached(ctx context.Context, period string) (payStubs []PayStub, err error)
AllPayStubsMonthlyCached retrieves held amount for all satellites per selected period from storagenode database.
func (*Service) AllPayStubsPeriodCached ¶ added in v1.1.1
func (service *Service) AllPayStubsPeriodCached(ctx context.Context, periodStart, periodEnd string) (payStubs []PayStub, err error)
AllPayStubsPeriodCached retrieves held amount for all satellites for selected range of months from storagenode database.
func (*Service) AllPaymentsMonthlyCached ¶ added in v1.1.1
func (service *Service) AllPaymentsMonthlyCached(ctx context.Context, period string) (payments []Payment, err error)
AllPaymentsMonthlyCached retrieves payments for all satellites per selected period from storagenode database.
func (*Service) AllPaymentsPeriodCached ¶ added in v1.1.1
func (service *Service) AllPaymentsPeriodCached(ctx context.Context, periodStart, periodEnd string) (payments []Payment, err error)
AllPaymentsPeriodCached retrieves payment for all satellites for selected range of months from storagenode database.
func (*Service) GetPayment ¶
func (service *Service) GetPayment(ctx context.Context, satelliteID storj.NodeID, period string) (_ *Payment, err error)
GetPayment retrieves payment data from particular satellite using grpc.
func (*Service) GetPaystubStats ¶
func (service *Service) GetPaystubStats(ctx context.Context, satelliteID storj.NodeID, period string) (_ *PayStub, err error)
GetPaystubStats retrieves held amount for particular satellite from satellite using grpc.
func (*Service) SatellitePayStubMonthlyCached ¶
func (service *Service) SatellitePayStubMonthlyCached(ctx context.Context, satelliteID storj.NodeID, period string) (payStub *PayStub, err error)
SatellitePayStubMonthlyCached retrieves held amount for particular satellite for selected month from storagenode database.
func (*Service) SatellitePayStubPeriodCached ¶ added in v1.1.1
func (service *Service) SatellitePayStubPeriodCached(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payStubs []PayStub, err error)
SatellitePayStubPeriodCached retrieves held amount for all satellites for selected months from storagenode database.
func (*Service) SatellitePaymentMonthlyCached ¶ added in v1.1.1
func (service *Service) SatellitePaymentMonthlyCached(ctx context.Context, satelliteID storj.NodeID, period string) (_ *Payment, err error)
SatellitePaymentMonthlyCached retrieves payment data from particular satellite from storagenode database.
func (*Service) SatellitePaymentPeriodCached ¶ added in v1.1.1
func (service *Service) SatellitePaymentPeriodCached(ctx context.Context, satelliteID storj.NodeID, periodStart, periodEnd string) (payments []*Payment, err error)
SatellitePaymentPeriodCached retrieves payment for all satellites for selected months from storagenode database.