heldamount

package
v1.7.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDataForPeriod = errs.Class("no payStub/payments for period error")

ErrNoDataForPeriod represents errors from the heldamount database.

Functions

This section is empty.

Types

type DB

type DB interface {
	// GetPaystub return payStub by nodeID and period.
	GetPaystub(ctx context.Context, nodeID storj.NodeID, period string) (PayStub, error)
	// GetAllPaystubs return all payStubs by nodeID.
	GetAllPaystubs(ctx context.Context, nodeID storj.NodeID) ([]PayStub, error)
	// CreatePaystub insert paystub into db.
	CreatePaystub(ctx context.Context, stub PayStub) (err error)
}

DB exposes all needed functionality to manage heldAmount.

architecture: Service

type Endpoint

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

Endpoint for querying node stats for the SNO

architecture: Endpoint

func NewEndpoint

func NewEndpoint(log *zap.Logger, accounting accounting.StoragenodeAccounting, overlay overlay.DB, service *Service) *Endpoint

NewEndpoint creates new endpoint

func (*Endpoint) GetAllPaystubs added in v1.3.2

func (e *Endpoint) GetAllPaystubs(ctx context.Context, req *pb.GetAllPaystubsRequest) (_ *pb.GetAllPaystubsResponse, err error)

GetAllPaystubs sends all paystubs for client node.

func (*Endpoint) GetPayStub

func (e *Endpoint) GetPayStub(ctx context.Context, req *pb.GetHeldAmountRequest) (_ *pb.GetHeldAmountResponse, err error)

GetPayStub sends node paystub for client node.

type PayStub

type PayStub struct {
	Period         string       `json:"period"`
	NodeID         storj.NodeID `json:"nodeId"`
	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 an entity that holds held amount of cash that will be paid to storagenode operator after some period.

type Service

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

Service is used to store and handle node paystub information

architecture: Service

func NewService

func NewService(log *zap.Logger, db DB) *Service

NewService returns a new Service.

func (*Service) GetAllPaystubs added in v1.3.2

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

GetAllPaystubs returns all paystubs by nodeID.

func (*Service) GetPayStub

func (service *Service) GetPayStub(ctx context.Context, nodeID storj.NodeID, period string) (PayStub, error)

GetPayStub returns PayStub by nodeID and period.

Jump to

Keyboard shortcuts

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