linktracker

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0, MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkTracker

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

LinkTracker records links being traversed to determine useful information in crafting responses for a peer. Specifically, if any in progress request has already sent a block for a given link, don't send it again. Second, keep track of whether links are missing blocks so you can determine at the end if a complete response has been transmitted.

func New

func New() *LinkTracker

New makes a new link tracker

func (*LinkTracker) BlockRefCount

func (lt *LinkTracker) BlockRefCount(link ipld.Link) int

BlockRefCount returns the number of times a present block has been traversed by in progress requests

func (*LinkTracker) Empty added in v0.1.1

func (lt *LinkTracker) Empty() bool

Empty returns true if the link tracker is empty

func (*LinkTracker) FinishRequest

func (lt *LinkTracker) FinishRequest(requestID graphsync.RequestID) (hasAllBlocks bool)

FinishRequest records that we have completed the given request, and returns true if all links traversed had blocks present.

func (lt *LinkTracker) IsKnownMissingLink(requestID graphsync.RequestID, link ipld.Link) bool

IsKnownMissingLink returns whether the given request recorded the given link as missing

func (*LinkTracker) RecordLinkTraversal

func (lt *LinkTracker) RecordLinkTraversal(requestID graphsync.RequestID, link ipld.Link, hasBlock bool)

RecordLinkTraversal records that we traversed a link during a request, and whether we had the block when we did it.

Jump to

Keyboard shortcuts

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