Documentation ¶
Index ¶
- type ResponseCache
- func (rc *ResponseCache) AttemptLoad(requestID graphsync.RequestID, link ipld.Link, linkContext ipld.LinkContext) ([]byte, error)
- func (rc *ResponseCache) FinishRequest(requestID graphsync.RequestID)
- func (rc *ResponseCache) ProcessResponse(ctx context.Context, responses map[graphsync.RequestID]metadata.Metadata, ...)
- type UnverifiedBlockStore
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