responsecache

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0, MIT Imports: 12 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, linkContext ipld.LinkContext) ([]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. It returns the total number of bytes in blocks that were being tracked but are no longer in memory

func (*ResponseCache) ProcessResponse

func (rc *ResponseCache) ProcessResponse(
	ctx context.Context,
	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, uint64) bool)
	PruneBlock(ipld.Link)
	VerifyBlock(ipld.Link, ipld.LinkContext) ([]byte, error)
	AddUnverifiedBlock(trace.Link, 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