responsebuilder

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT, 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(topic Topic) *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

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

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

func (*ResponseBuilder) Topic

func (rb *ResponseBuilder) Topic() Topic

Topic returns the identifier for notifications sent about this response builder

type Topic

type Topic uint64

Topic is an identifier for notifications about this response builder

Jump to

Keyboard shortcuts

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