dtsync

package
v0.5.19 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0, MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const LegsVoucherResultType = datatransfer.TypeIdentifier("LegsVoucherResult")
View Source
const LegsVoucherType = datatransfer.TypeIdentifier("LegsVoucher")

Variables

View Source
var BindnodeRegistry = bindnoderegistry.NewRegistry()

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithAllowPeer

func WithAllowPeer(allowPeer func(peer.ID) bool) Option

WithAllowPeer sets the function that determines whether to allow or reject graphsync sessions from a peer.

func WithMaxGraphsyncRequests added in v0.0.9

func WithMaxGraphsyncRequests(maxIn, maxOut uint64) Option

type Publisher added in v0.0.5

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

Publisher serves an advertisement over libp2p using data-transfer.

func NewPublisher

func NewPublisher(host host.Host, ds datastore.Batching, lsys ipld.LinkSystem, topicName string, options ...Option) (*Publisher, error)

NewPublisher creates a new dagsync publisher.

func NewPublisherFromExisting

func NewPublisherFromExisting(dtManager dt.Manager, host host.Host, topicName string, lsys ipld.LinkSystem, options ...Option) (*Publisher, error)

NewPublisherFromExisting instantiates publishing on an existing data transfer instance.

func (*Publisher) Addrs added in v0.0.5

func (p *Publisher) Addrs() []multiaddr.Multiaddr

Addrs returns the multiaddrs of the publisher's host.

func (*Publisher) Close added in v0.0.5

func (p *Publisher) Close() error

Close closes the publisher.

func (*Publisher) ID added in v0.0.5

func (p *Publisher) ID() peer.ID

ID returns the peer ID of the publisher's host.

func (*Publisher) Protocol added in v0.0.5

func (p *Publisher) Protocol() int

Protocol returns the multihash protocol ID of the transport used by the publisher.

func (*Publisher) SetRoot added in v0.0.5

func (p *Publisher) SetRoot(c cid.Cid)

SetRoot sets the root CID of the advertisement chain.

type Sync

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

Sync provides sync functionality for use with all datatransfer syncs.

func NewSync

func NewSync(host host.Host, ds datastore.Batching, lsys ipld.LinkSystem, blockHook func(peer.ID, cid.Cid), gsMaxInReq, gsMaxOutReq uint64) (*Sync, error)

NewSync creates a new Sync with its own datatransfer.Manager.

func (*Sync) Close

func (s *Sync) Close() error

Close unregisters datatransfer event notification. If this Sync owns the datatransfer.Manager then the Manager is stopped.

func (*Sync) NewSyncer

func (s *Sync) NewSyncer(peerInfo peer.AddrInfo, topicName string) *Syncer

NewSyncer creates a new Syncer to use for a single sync operation against a peer.

type Syncer

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

Syncer handles a single sync with a provider.

func (*Syncer) GetHead

func (s *Syncer) GetHead(ctx context.Context) (cid.Cid, error)

GetHead queries a provider for the latest CID.

func (*Syncer) SameAddrs added in v0.5.14

func (s *Syncer) SameAddrs(maddrs []multiaddr.Multiaddr) bool

func (*Syncer) Sync

func (s *Syncer) Sync(ctx context.Context, nextCid cid.Cid, sel ipld.Node) error

Sync opens a datatransfer data channel and uses the selector to pull data from the provider.

type Voucher

type Voucher struct {
	Head *cid.Cid
}

A Voucher is used to communicate a new DAG head

func VoucherFromNode

func VoucherFromNode(node datamodel.Node) (*Voucher, error)

reads a voucher from an ipld node

func (*Voucher) AsVoucher

func (v *Voucher) AsVoucher() datatransfer.TypedVoucher

func (*Voucher) MarshalCBOR

func (t *Voucher) MarshalCBOR(w io.Writer) error

func (*Voucher) UnmarshalCBOR

func (t *Voucher) UnmarshalCBOR(r io.Reader) error

type VoucherResult

type VoucherResult struct {
	Code uint64
}

A VoucherResult responds to a voucher

func VoucherResultFromNode

func VoucherResultFromNode(node datamodel.Node) (*VoucherResult, error)

reads a voucher from an ipld node

func (*VoucherResult) AsVoucher

func (vr *VoucherResult) AsVoucher() datatransfer.TypedVoucher

func (*VoucherResult) MarshalCBOR

func (t *VoucherResult) MarshalCBOR(w io.Writer) error

func (*VoucherResult) UnmarshalCBOR

func (t *VoucherResult) UnmarshalCBOR(r io.Reader) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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