vouchers

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrVerify is returned when voucher fields are not valid.
	ErrVerify = errs.Class("verification")
)
View Source
var (
	// VoucherError represents errors with vouchers
	VoucherError = errs.Class("voucher")
)

Functions

This section is empty.

Types

type Config added in v0.14.0

type Config struct {
	Interval time.Duration `help:"interval between voucher service iterations" default:"168h0m0s"`
}

Config defines configuration for requesting vouchers.

type DB

type DB interface {
	// Put inserts or updates a voucher from a satellite
	Put(context.Context, *pb.Voucher) error
	// GetValid returns one valid voucher from the list of approved satellites
	GetValid(context.Context, []storj.NodeID) (*pb.Voucher, error)
	// NeedVoucher returns true if a voucher from a particular satellite is expired, about to expire, or does not exist
	NeedVoucher(context.Context, storj.NodeID, time.Duration) (bool, error)
}

DB implements storing and retrieving vouchers

type Service added in v0.14.0

type Service struct {
	Loop sync2.Cycle
	// contains filtered or unexported fields
}

Service is a service for requesting vouchers

func NewService added in v0.14.0

func NewService(log *zap.Logger, kad *kademlia.Kademlia, transport transport.Client, vouchersdb DB, trust *trust.Pool, interval, expirationBuffer time.Duration) *Service

NewService creates a new voucher service

func (*Service) Close added in v0.14.0

func (service *Service) Close() error

Close stops the voucher service

func (*Service) Request added in v0.14.0

func (service *Service) Request(ctx context.Context, satelliteID storj.NodeID)

Request makes a voucher request to a satellite

func (*Service) Run added in v0.14.0

func (service *Service) Run(ctx context.Context) (err error)

Run sends requests to satellites for vouchers

func (*Service) RunOnce added in v0.14.0

func (service *Service) RunOnce(ctx context.Context) (err error)

RunOnce runs one iteration of the voucher request service

func (*Service) VerifyVoucher added in v0.14.0

func (service *Service) VerifyVoucher(ctx context.Context, satellite storj.NodeID, voucher *pb.Voucher) (err error)

VerifyVoucher verifies that the signature and the information contained in a voucher are valid

Jump to

Keyboard shortcuts

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