heldamount

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 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.

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

Error is the default error class for heldamount 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)
	// CreatePaystub insert paystub into db.
	CreatePaystub(ctx context.Context, stub PayStub) (err error)
	// GetPayment return storagenode payment by nodeID and period.
	GetPayment(ctx context.Context, nodeID storj.NodeID, period string) (StoragenodePayment, error)
	// CreatePayment insert payment into db.
	CreatePayment(ctx context.Context, payment StoragenodePayment) (err error)
	// GetAllPayments return all payments by nodeID.
	GetAllPayments(ctx context.Context, nodeID storj.NodeID) ([]StoragenodePayment, 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) GetAllPayments added in v1.8.1

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

GetAllPayments sends all payments to node.

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.

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 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) GetAllPayments added in v1.8.1

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

GetAllPayments returns all payments by nodeID.

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.

func (*Service) GetPayment

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

GetPayment returns storagenode payment data by nodeID and period.

type StoragenodePayment

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

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

Jump to

Keyboard shortcuts

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