pointerverification

package
v1.61.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pointerverification implements verification of pointers.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error general pointer verification error.
	Error = errs.Class("pointer verification")
)

Functions

func VerifyPieceAndLimit

func VerifyPieceAndLimit(ctx context.Context, piece *pb.SegmentPieceUploadResult, limit *pb.OrderLimit) (err error)

VerifyPieceAndLimit verifies that the piece and limit match.

Types

type IdentityCache

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

IdentityCache implements caching of *identity.PeerIdentity.

func NewIdentityCache

func NewIdentityCache(db overlay.PeerIdentities) *IdentityCache

NewIdentityCache returns an IdentityCache.

func (*IdentityCache) EnsureCached

func (cache *IdentityCache) EnsureCached(ctx context.Context, nodes []storj.NodeID) (err error)

EnsureCached loads any missing identity into cache.

func (*IdentityCache) GetCached

func (cache *IdentityCache) GetCached(ctx context.Context, id storj.NodeID) *identity.PeerIdentity

GetCached returns the peer identity in the cache.

func (*IdentityCache) GetUpdated

func (cache *IdentityCache) GetUpdated(ctx context.Context, id storj.NodeID) (_ *identity.PeerIdentity, err error)

GetUpdated returns the identity from database and updates the cache.

type InvalidPiece

type InvalidPiece struct {
	NodeID   storj.NodeID
	PieceNum int32
	Reason   error
}

InvalidPiece is information about an invalid piece in the pointer.

type Service

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

Service is a service for verifying validity of pieces.

func NewService

func NewService(db overlay.PeerIdentities) *Service

NewService returns a service using the provided database.

func (*Service) SelectValidPieces

func (service *Service) SelectValidPieces(ctx context.Context, uploadResponses []*pb.SegmentPieceUploadResult, originalLimits []*pb.OrderLimit) (valid []*pb.SegmentPieceUploadResult, invalid []InvalidPiece, err error)

SelectValidPieces selects pieces that are have correct hashes and match the original limits.

func (*Service) VerifySizes

func (service *Service) VerifySizes(ctx context.Context, redundancy storj.RedundancyScheme, encryptedSize int64, uploadResponses []*pb.SegmentPieceUploadResult) (err error)

VerifySizes verifies that the remote piece sizes in commitSegment match each other.

Jump to

Keyboard shortcuts

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