Documentation ¶
Index ¶
- func MaxLinks(maxLinks uint64) datatransfer.TransportOption
- func UseStore(store ipld.LinkSystem) datatransfer.TransportOption
- type ChannelGraphsyncRequests
- type ChannelsForPeer
- type Option
- type Transport
- func (t *Transport) ChannelsForPeer(p peer.ID) ChannelsForPeer
- func (t *Transport) CleanupChannel(chid datatransfer.ChannelID)
- func (t *Transport) CloseChannel(ctx context.Context, chid datatransfer.ChannelID) error
- func (t *Transport) MaxLinks(channelID datatransfer.ChannelID, maxLinks uint64)
- func (t *Transport) OpenChannel(ctx context.Context, dataSender peer.ID, channelID datatransfer.ChannelID, ...) error
- func (t *Transport) PauseChannel(ctx context.Context, chid datatransfer.ChannelID) error
- func (t *Transport) ResumeChannel(ctx context.Context, msg datatransfer.Message, chid datatransfer.ChannelID) error
- func (t *Transport) SetEventHandler(events datatransfer.EventsHandler) error
- func (t *Transport) Shutdown(ctx context.Context) error
- func (t *Transport) UseStore(channelID datatransfer.ChannelID, lsys ipld.LinkSystem) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxLinks ¶
func MaxLinks(maxLinks uint64) datatransfer.TransportOption
MaxLinks sets the maximum number of links for this channelID
func UseStore ¶
func UseStore(store ipld.LinkSystem) datatransfer.TransportOption
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 ¶
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 ¶
CloseChannel closes the given data-transfer channel
func (*Transport) MaxLinks ¶
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 ¶
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) 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