responsecache

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT, Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseCache

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

ResponseCache maintains a store of unverified blocks and response data about links for loading, and prunes blocks as needed.

func New

func New(unverifiedBlockStore UnverifiedBlockStore) *ResponseCache

New initializes a new ResponseCache using the given unverified block store.

func (*ResponseCache) AttemptLoad

func (rc *ResponseCache) AttemptLoad(requestID graphsync.RequestID, link ipld.Link) ([]byte, error)

AttemptLoad attempts to laod the given block from the cache

func (*ResponseCache) FinishRequest

func (rc *ResponseCache) FinishRequest(requestID graphsync.RequestID)

FinishRequest indicate there is no more need to track blocks tied to this response

func (*ResponseCache) ProcessResponse

func (rc *ResponseCache) ProcessResponse(responses map[graphsync.RequestID]metadata.Metadata,
	blks []blocks.Block)

ProcessResponse processes incoming response data, adding unverified blocks, and tracking link metadata from a remote peer

type UnverifiedBlockStore

type UnverifiedBlockStore interface {
	PruneBlocks(func(ipld.Link) bool)
	PruneBlock(ipld.Link)
	VerifyBlock(ipld.Link) ([]byte, error)
	AddUnverifiedBlock(ipld.Link, []byte)
}

UnverifiedBlockStore is an interface for storing blocks as they come in and removing them as they are verified

Jump to

Keyboard shortcuts

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