estimatedpayouts

package
v1.45.4-rc Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EstimationServiceErr defines sno service error.
	EstimationServiceErr = errs.Class("estimationservice")
)

Functions

func RoundFloat

func RoundFloat(value float64) float64

RoundFloat rounds float value till 2 signs after dot.

Types

type EstimatedPayout

type EstimatedPayout struct {
	CurrentMonth             PayoutMonthly `json:"currentMonth"`
	PreviousMonth            PayoutMonthly `json:"previousMonth"`
	CurrentMonthExpectations int64         `json:"currentMonthExpectations"`
}

EstimatedPayout contains usage and estimated payouts data for current and previous months.

func (*EstimatedPayout) Add added in v1.25.1

func (estimatedPayout *EstimatedPayout) Add(other EstimatedPayout)

Add adds estimate into the receiver.

func (*EstimatedPayout) Set added in v1.25.1

func (estimatedPayout *EstimatedPayout) Set(current, previous PayoutMonthly, now, joinedAt time.Time)

Set set's estimated payout with current/previous PayoutMonthly's data and current month expectations.

type PayoutMonthly

type PayoutMonthly struct {
	EgressBandwidth         int64   `json:"egressBandwidth"`
	EgressBandwidthPayout   float64 `json:"egressBandwidthPayout"`
	EgressRepairAudit       int64   `json:"egressRepairAudit"`
	EgressRepairAuditPayout float64 `json:"egressRepairAuditPayout"`
	DiskSpace               float64 `json:"diskSpace"`
	DiskSpacePayout         float64 `json:"diskSpacePayout"`
	HeldRate                float64 `json:"heldRate"`
	Payout                  float64 `json:"payout"`
	Held                    float64 `json:"held"`
}

PayoutMonthly contains usage and estimated payouts date.

func (*PayoutMonthly) Add added in v1.25.1

func (pm *PayoutMonthly) Add(monthly PayoutMonthly)

Add sums payout monthly data.

func (*PayoutMonthly) SetDiskSpacePayout

func (pm *PayoutMonthly) SetDiskSpacePayout(diskSpacePrice int64)

SetDiskSpacePayout counts disk space payouts for PayoutMonthly object.

func (*PayoutMonthly) SetEgressBandwidthPayout

func (pm *PayoutMonthly) SetEgressBandwidthPayout(egressPrice int64)

SetEgressBandwidthPayout counts egress bandwidth payouts for PayoutMonthly object.

func (*PayoutMonthly) SetEgressRepairAuditPayout

func (pm *PayoutMonthly) SetEgressRepairAuditPayout(auditRepairPrice int64)

SetEgressRepairAuditPayout counts audit and repair payouts for PayoutMonthly object.

func (*PayoutMonthly) SetHeldAmount

func (pm *PayoutMonthly) SetHeldAmount()

SetHeldAmount counts held amount for PayoutMonthly object.

func (*PayoutMonthly) SetPayout

func (pm *PayoutMonthly) SetPayout()

SetPayout counts payouts amount for PayoutMonthly object.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is handling storage node estimation payouts logic.

architecture: Service

func NewService

func NewService(bandwidthDB bandwidth.DB, reputationDB reputation.DB, storageUsageDB storageusage.DB, pricingDB pricing.DB, satelliteDB satellites.DB, trust *trust.Pool) *Service

NewService returns new instance of Service.

func (*Service) GetAllSatellitesEstimatedPayout

func (s *Service) GetAllSatellitesEstimatedPayout(ctx context.Context, now time.Time) (payout EstimatedPayout, err error)

GetAllSatellitesEstimatedPayout returns estimated payouts for current and previous months from all satellites with current level of load.

func (*Service) GetSatelliteEstimatedPayout

func (s *Service) GetSatelliteEstimatedPayout(ctx context.Context, satelliteID storj.NodeID, now time.Time) (payout EstimatedPayout, err error)

GetSatelliteEstimatedPayout returns estimated payouts for current and previous months from specific satellite with current level of load.

Jump to

Keyboard shortcuts

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