snopayouts

package
v1.30.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 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")

ErrNoDataForPeriod represents errors from the payouts database.

View Source
var Error = errs.Class("payoutsdb")

Error is the default error class for payouts package.

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)

	// GetPayment return storagenode payment by nodeID and period.
	GetPayment(ctx context.Context, nodeID storj.NodeID, period string) (Payment, error)
	// GetAllPayments return all payments by nodeID.
	GetAllPayments(ctx context.Context, nodeID storj.NodeID) ([]Payment, error)

	// TestCreatePaystub insert paystub into db. Only used for tests.
	TestCreatePaystub(ctx context.Context, stub Paystub) (err error)
	// TestCreatePayment insert payment into db. Only used for tests.
	TestCreatePayment(ctx context.Context, payment Payment) (err error)
}

DB exposes all needed functionality to manage payouts.

architecture: Service

type Endpoint

type Endpoint struct {
	pb.DRPCHeldAmountUnimplementedServer
	// 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) GetAllPayments

func (e *Endpoint) GetAllPayments(ctx context.Context, req *pb.GetAllPaymentsRequest) (_ *pb.GetAllPaymentsResponse, err error)

GetAllPayments sends all payments to node.

func (*Endpoint) GetAllPaystubs

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.

func (*Endpoint) GetPayment

func (e *Endpoint) GetPayment(ctx context.Context, req *pb.GetPaymentRequest) (_ *pb.GetPaymentResponse, err error)

GetPayment sends node payment data for client node.

type Payment added in v1.21.3

type Payment struct {
	ID      int64        `json:"id"`
	Created time.Time    `json:"created"`
	NodeID  storj.NodeID `json:"nodeId"`
	Period  string       `json:"period"`
	Amount  int64        `json:"amount"`
	Receipt string       `json:"receipt"`
	Notes   string       `json:"notes"`
}

Payment is an entity that holds payment to storagenode operator parameters.

type Paystub added in v1.21.3

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"`
	Distributed    int64        `json:"distributed"`
}

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) GetAllPayments

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

GetAllPayments returns all payments by nodeID.

func (*Service) GetAllPaystubs

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

GetAllPaystubs returns all paystubs by nodeID.

func (*Service) GetPayment

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

GetPayment returns storagenode payment data by nodeID and period.

func (*Service) GetPaystub added in v1.21.3

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