responsebuilder

package
v0.0.6-0...-9dfb6b8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

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 New

func New() *ResponseBuilder

New generates a new ResponseBuilder.

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 (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

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

Jump to

Keyboard shortcuts

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