heldamount

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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

type AmountPeriod struct {
	Period string `json:"period"`
	Held   int64  `json:"held"`
}

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

func (*Client) Close

func (c *Client) Close() error

Close closes underlying client connection

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)
	// 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)
}

DB works with heldamount database

architecture: Database

type EstimatedPayout added in v1.6.1

type EstimatedPayout struct {
	CurrentMonthEstimatedAmount int64         `json:"currentAmount"`
	CurrentMonthHeld            int64         `json:"currentHeld"`
	PreviousMonthPayout         PayoutMonthly `json:"previousPayout"`
}

EstimatedPayout contains amount in cents of estimated payout 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"`
	FourthPeriod  int64        `json:"fourthPeriod"`
}

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"`
}

PayStub is node heldamount data for satellite by specific period.

type PayoutMonthly added in v1.6.1

type PayoutMonthly struct {
	EgressBandwidth   int64   `json:"egressBandwidth"`
	EgressPayout      int64   `json:"egressPayout"`
	EgressRepairAudit int64   `json:"egressRepairAudit"`
	RepairAuditPayout int64   `json:"repairAuditPayout"`
	DiskSpace         float64 `json:"diskSpace"`
	DiskSpaceAmount   int64   `json:"diskSpaceAmount"`
	HeldPercentRate   int64   `json:"heldRate"`
}

PayoutMonthly contains bandwidth and payout amount for month.

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, dialer rpc.Dialer, 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) 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) AllPeriods added in v1.6.1

func (service *Service) AllPeriods(ctx context.Context) (_ []string, err error)

AllPeriods retrieves all periods in which we have some heldamount data.

func (*Service) GetAllPaystubs added in v1.3.2

func (service *Service) GetAllPaystubs(ctx context.Context, satelliteID storj.NodeID) (_ []PayStub, err error)

GetAllPaystubs retrieves all paystubs for particular satellite.

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 RPC.

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) SatellitePeriods added in v1.6.1

func (service *Service) SatellitePeriods(ctx context.Context, satelliteID storj.NodeID) (_ []string, err error)

SatellitePeriods retrieves all periods for concrete satellite in which we have some heldamount data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL