httpsync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0, MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignedHeadSchema

func SignedHeadSchema() schema.Type

Types

type Option

type Option func(*config) error

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

func WithAnnounceSenders

func WithAnnounceSenders(senders ...announce.Sender) Option

WithAnnounceSenders sets announce.Senders to use for sending announcements.

func WithExtraData

func WithExtraData(data []byte) Option

WithExtraData sets the extra data to include in the pubsub message.

type Publisher added in v0.0.5

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

func NewPublisher

func NewPublisher(address string, lsys ipld.LinkSystem, privKey ic.PrivKey, options ...Option) (*Publisher, error)

NewPublisher creates a new http publisher, listening on the specified address.

func NewPublisherForListener added in v0.1.0

func NewPublisherForListener(listener net.Listener, handlerPath string, lsys ipld.LinkSystem, privKey ic.PrivKey, options ...Option) (*Publisher, error)

NewPublisherForListener creates a new http publisher for an existing listener. When providing an existing listener, running the HTTP server is the caller's responsibility. ServeHTTP on the returned Publisher can be used to handle requests. handlerPath is the path to handle requests on, e.g. "ipni" for `/ipni/...` requests.

func (*Publisher) Addrs added in v0.0.5

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

Addrs returns the addresses, as []multiaddress, that the Publisher is listening on.

func (*Publisher) AnnounceHead added in v0.0.5

func (p *Publisher) AnnounceHead(ctx context.Context) error

func (*Publisher) AnnounceHeadWithAddrs added in v0.0.5

func (p *Publisher) AnnounceHeadWithAddrs(ctx context.Context, addrs []multiaddr.Multiaddr) error

func (*Publisher) Close added in v0.0.5

func (p *Publisher) Close() error

func (*Publisher) ID added in v0.0.5

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

func (*Publisher) Protocol added in v0.0.5

func (p *Publisher) Protocol() int

func (*Publisher) ServeHTTP added in v0.0.5

func (p *Publisher) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Publisher) SetRoot added in v0.0.5

func (p *Publisher) SetRoot(_ context.Context, c cid.Cid) error

func (*Publisher) UpdateRoot added in v0.0.5

func (p *Publisher) UpdateRoot(ctx context.Context, c cid.Cid) error

func (*Publisher) UpdateRootWithAddrs added in v0.0.5

func (p *Publisher) UpdateRootWithAddrs(ctx context.Context, c cid.Cid, addrs []multiaddr.Multiaddr) error

type Sync

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

Sync provides sync functionality for use with all http syncs.

func NewSync

func NewSync(lsys ipld.LinkSystem, client *http.Client, blockHook func(peer.ID, cid.Cid)) *Sync

func (*Sync) Close

func (s *Sync) Close()

func (*Sync) NewSyncer

func (s *Sync) NewSyncer(peerID peer.ID, peerAddrs []multiaddr.Multiaddr, rateLimiter *rate.Limiter) (*Syncer, error)

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
}

func (*Syncer) GetHead

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

func (*Syncer) Sync

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

Jump to

Keyboard shortcuts

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