bwagreement

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error the default bwagreement errs class
	Error = errs.Class("bwagreement error")
)

Functions

This section is empty.

Types

type Config

type Config struct {
}

Config is a configuration struct that is everything you need to start an agreement receiver responsibility

type DB

type DB interface {
	// SaveOrder saves an order for accounting
	SaveOrder(context.Context, *pb.Order) error
	// GetTotalsSince returns the sum of each bandwidth type after (exluding) a given date range
	GetTotals(context.Context, time.Time, time.Time) (map[storj.NodeID][]int64, error)
	//GetTotals returns stats about an uplink
	GetUplinkStats(context.Context, time.Time, time.Time) ([]UplinkStat, error)
	//GetExpired gets orders that are expired and were created before some time
	GetExpired(context.Context, time.Time, time.Time) ([]SavedOrder, error)
	//DeleteExpired deletes orders that are expired and were created before some time
	DeleteExpired(context.Context, time.Time, time.Time) error
}

DB stores orders for accounting purposes

type SavedOrder

type SavedOrder struct {
	Serialnum     string
	StorageNodeID storj.NodeID
	UplinkID      storj.NodeID
	Action        int64
	Total         int64
	CreatedAt     time.Time
	ExpiresAt     time.Time
}

SavedOrder is information from an Order pertaining to accounting

type Server

type Server struct {
	NodeID storj.NodeID
	// contains filtered or unexported fields
}

Server is an implementation of the pb.BandwidthServer interface

func NewServer

func NewServer(db DB, upldb certdb.DB, pkey crypto.PublicKey, log *zap.Logger, nodeID storj.NodeID) *Server

NewServer creates instance of Server

func (*Server) BandwidthAgreements

func (s *Server) BandwidthAgreements(ctx context.Context, rba *pb.Order) (reply *pb.AgreementsSummary, err error)

BandwidthAgreements receives and stores bandwidth agreements from storage nodes

func (*Server) Close

func (s *Server) Close() error

Close closes resources

func (*Server) Settlement

func (s *Server) Settlement(client pb.Bandwidth_SettlementServer) (err error)

Settlement receives and handles agreements.

type UplinkStat

type UplinkStat struct {
	NodeID            storj.NodeID
	TotalBytes        int64
	PutActionCount    int
	GetActionCount    int
	TotalTransactions int
}

UplinkStat contains information about an uplink's returned Orders

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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