Documentation ¶
Overview ¶
Package pointerverification implements verification of pointers.
Index ¶
- Variables
- func VerifyPieceAndLimit(ctx context.Context, piece *pb.RemotePiece, limit *pb.OrderLimit) (err error)
- type IdentityCache
- func (cache *IdentityCache) EnsureCached(ctx context.Context, pieces []*pb.RemotePiece) (err error)
- func (cache *IdentityCache) GetCached(ctx context.Context, id storj.NodeID) *identity.PeerIdentity
- func (cache *IdentityCache) GetUpdated(ctx context.Context, id storj.NodeID) (_ *identity.PeerIdentity, err error)
- type InvalidPiece
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( // Error general pointer verification error. Error = errs.Class("pointer verification") )
Functions ¶
func VerifyPieceAndLimit ¶
func VerifyPieceAndLimit(ctx context.Context, piece *pb.RemotePiece, 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, pieces []*pb.RemotePiece) (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 ¶
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, pointer *pb.Pointer, originalLimits []*pb.OrderLimit) (valid []*pb.RemotePiece, invalid []InvalidPiece, err error)
SelectValidPieces selects pieces that are have correct hashes and match the original limits.