Documentation ¶
Index ¶
- type ResponseBuilder
- func (rb *ResponseBuilder) AddBlock(block blocks.Block)
- func (rb *ResponseBuilder) AddCompletedRequest(requestID graphsync.RequestID, status graphsync.ResponseStatusCode)
- func (rb *ResponseBuilder) AddExtensionData(requestID graphsync.RequestID, extension graphsync.ExtensionData)
- func (rb *ResponseBuilder) AddLink(requestID graphsync.RequestID, link ipld.Link, blockPresent bool)
- func (rb *ResponseBuilder) BlockSize() int
- func (rb *ResponseBuilder) Build(ipldBridge ipldbridge.IPLDBridge) ([]gsmsg.GraphSyncResponse, []blocks.Block, error)
- func (rb *ResponseBuilder) Empty() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseBuilder ¶
type ResponseBuilder struct {
// contains filtered or unexported fields
}
ResponseBuilder captures componenst of a response message across multiple requests for a given peer and then generates the corresponding GraphSync message components once responses are ready to send.
func (*ResponseBuilder) AddBlock ¶
func (rb *ResponseBuilder) AddBlock(block blocks.Block)
AddBlock adds the given block to the response.
func (*ResponseBuilder) AddCompletedRequest ¶
func (rb *ResponseBuilder) AddCompletedRequest(requestID graphsync.RequestID, status graphsync.ResponseStatusCode)
AddCompletedRequest marks the given request as completed in the response, as well as whether the graphsync request responded with complete or partial data.
func (*ResponseBuilder) AddExtensionData ¶
func (rb *ResponseBuilder) AddExtensionData(requestID graphsync.RequestID, extension graphsync.ExtensionData)
AddExtensionData adds the given extension data to to the response
func (*ResponseBuilder) AddLink ¶
func (rb *ResponseBuilder) AddLink(requestID graphsync.RequestID, link ipld.Link, blockPresent bool)
AddLink adds the given link and whether its block is present to the response for the given request ID.
func (*ResponseBuilder) BlockSize ¶
func (rb *ResponseBuilder) BlockSize() int
BlockSize returns the total size of all blocks in this response
func (*ResponseBuilder) Build ¶
func (rb *ResponseBuilder) Build(ipldBridge ipldbridge.IPLDBridge) ([]gsmsg.GraphSyncResponse, []blocks.Block, error)
Build assembles and encodes response data from the added requests, links, and blocks.
func (*ResponseBuilder) Empty ¶
func (rb *ResponseBuilder) Empty() bool
Empty returns true if there is no content to send