responsebuilder

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 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) AddExtensionData added in v0.0.4

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) AddResponseCode added in v0.1.0

func (rb *ResponseBuilder) AddResponseCode(requestID graphsync.RequestID, status graphsync.ResponseStatusCode)

AddResponseCode marks the given request as completed in the response, as well as whether the graphsync request responded with complete or partial data.

func (*ResponseBuilder) BlockSize

func (rb *ResponseBuilder) BlockSize() uint64

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