graphsync

package
v2.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxLinks(maxLinks uint64) datatransfer.TransportOption

MaxLinks sets the maximum number of links for this channelID

Types

type ChannelGraphsyncRequests

type ChannelGraphsyncRequests struct {
	// Current is the current request ID for the transfer
	Current graphsync.RequestID
	// Previous are ids of previous GraphSync requests in a transfer that
	// has been restarted. We may be interested to know if these IDs are active
	// on either side of the request
	Previous []graphsync.RequestID
}

ChannelGraphsyncRequests describes any graphsync request IDs associated with a given channel

type ChannelsForPeer

type ChannelsForPeer struct {
	SendingChannels   map[datatransfer.ChannelID]ChannelGraphsyncRequests
	ReceivingChannels map[datatransfer.ChannelID]ChannelGraphsyncRequests
}

ChannelsForPeer describes current active channels for a given peer and their associated graphsync requests

type Option

type Option func(*Transport)

Option is an option for setting up the graphsync transport

func RegisterCompletedRequestListener

func RegisterCompletedRequestListener(l func(channelID datatransfer.ChannelID)) Option

RegisterCompletedRequestListener is used by the tests

func RegisterCompletedResponseListener

func RegisterCompletedResponseListener(l func(channelID datatransfer.ChannelID)) Option

RegisterCompletedResponseListener is used by the tests

func SupportedExtensions

func SupportedExtensions(supportedExtensions []graphsync.ExtensionName) Option

SupportedExtensions sets what data transfer extensions are supported

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

Transport manages graphsync hooks for data transfer, translating from graphsync hooks to semantic data transfer events

func NewTransport

func NewTransport(peerID peer.ID, gs graphsync.GraphExchange, options ...Option) *Transport

NewTransport makes a new hooks manager with the given hook events interface

func (*Transport) ChannelsForPeer

func (t *Transport) ChannelsForPeer(p peer.ID) ChannelsForPeer

ChannelsForPeer identifies which channels are open and which request IDs they map to

func (*Transport) CleanupChannel

func (t *Transport) CleanupChannel(chid datatransfer.ChannelID)

CleanupChannel is called on the otherside of a cancel - removes any associated data for the channel

func (*Transport) CloseChannel

func (t *Transport) CloseChannel(ctx context.Context, chid datatransfer.ChannelID) error

CloseChannel closes the given data-transfer channel

func (t *Transport) MaxLinks(channelID datatransfer.ChannelID, maxLinks uint64)

MaxLinks sets the maximum number of links for this channelID

func (*Transport) OpenChannel

func (t *Transport) OpenChannel(
	ctx context.Context,
	dataSender peer.ID,
	channelID datatransfer.ChannelID,
	root ipld.Link,
	stor datamodel.Node,
	channel datatransfer.ChannelState,
	msg datatransfer.Message,
) error

OpenChannel initiates an outgoing request for the other peer to send data to us on this channel Note: from a data transfer symantic standpoint, it doesn't matter if the request is push or pull -- OpenChannel is called by the party that is intending to receive data

func (*Transport) PauseChannel

func (t *Transport) PauseChannel(ctx context.Context, chid datatransfer.ChannelID) error

PauseChannel pauses the given data-transfer channel

func (*Transport) ResumeChannel

func (t *Transport) ResumeChannel(
	ctx context.Context,
	msg datatransfer.Message,
	chid datatransfer.ChannelID,
) error

ResumeChannel resumes the given data-transfer channel and sends the message if there is one

func (*Transport) SetEventHandler

func (t *Transport) SetEventHandler(events datatransfer.EventsHandler) error

SetEventHandler sets the handler for events on channels

func (*Transport) Shutdown

func (t *Transport) Shutdown(ctx context.Context) error

Shutdown disconnects a transport interface from graphsync

func (*Transport) UseStore

func (t *Transport) UseStore(channelID datatransfer.ChannelID, lsys ipld.LinkSystem) error

UseStore tells the graphsync transport to use the given loader and storer for this channelID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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