Documentation ¶
Overview ¶
Package responseassembler assembles responses that are queued for sending in outgoing messages
The response assembler's Transaction method allows a caller to specify response actions that will go into a single libp2p2 message. The response assembler will also deduplicate blocks that have already been sent over the network in a previous message
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerMessageHandler ¶
type PeerMessageHandler interface {
AllocateAndBuildMessage(p peer.ID, blkSize uint64, buildResponseFn func(*messagequeue.Builder))
}
PeerMessageHandler is an interface that can queue a response for a given peer to go out over the network If blkSize > 0, message building may block until enough memory has been freed from the queues to allocate the message.
type ResponseAssembler ¶
type ResponseAssembler struct { *peermanager.PeerManager // contains filtered or unexported fields }
ResponseAssembler manages assembling responses to go out over the network in libp2p messages
func New ¶
func New(ctx context.Context, peerHandler PeerMessageHandler) *ResponseAssembler
New generates a new ResponseAssembler for sending responses
func (*ResponseAssembler) NewStream ¶ added in v0.11.4
func (ra *ResponseAssembler) NewStream(ctx context.Context, p peer.ID, requestID graphsync.RequestID, subscriber notifications.Subscriber) ResponseStream
type ResponseBuilder ¶
type ResponseBuilder interface { // SendResponse adds a response to this transaction. SendResponse( link ipld.Link, data []byte, ) graphsync.BlockData // SendExtensionData adds extension data to the transaction. SendExtensionData(graphsync.ExtensionData) // SendUpdates sets up a PartialResponse with just the extension data provided SendUpdates([]graphsync.ExtensionData) // FinishRequest completes the response to a request. FinishRequest() graphsync.ResponseStatusCode // FinishWithError end the response due to an error FinishWithError(status graphsync.ResponseStatusCode) // PauseRequest temporarily halts responding to the request PauseRequest() // Context returns the execution context for this transaction Context() context.Context }
ResponseBuilder is a limited interface for assembling responses inside a transaction, so that they are included in the same message on the protocol
type ResponseStream ¶ added in v0.11.4
type ResponseStream interface { Transaction(transaction Transaction) error DedupKey(key string) IgnoreBlocks(links []ipld.Link) SkipFirstBlocks(skipFirstBlocks int64) // ClearRequest removes all tracking for this request. ClearRequest() }
type Transaction ¶
type Transaction func(ResponseBuilder) error
Transaction is a series of operations that should be send together in a single response