linktracker

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0, MIT Imports: 2 Imported by: 0

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 ld.Link) int

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

func (*LinkTracker) Empty

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 ld.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 ld.Link, hasBlock bool)

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL