publisher

package
v0.0.0-...-07a5409 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0, MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContextIDNotFound signals that no item is associated to the given
	// context ID.
	ErrContextIDNotFound = errors.New("context ID not found")

	// ErrAlreadyAdvertised signals that an advertisement for identical content
	// was already published.
	ErrAlreadyAdvertised = errors.New("advertisement already published")
)

Functions

This section is empty.

Types

type IPNIPublisher

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

func New

func New(id crypto.PrivKey, store store.PublisherStore, opts ...Option) (*IPNIPublisher, error)

func (*IPNIPublisher) Publish

func (p *IPNIPublisher) Publish(ctx context.Context, providerInfo peer.AddrInfo, contextID string, digests iter.Seq[mh.Multihash], meta metadata.Metadata) (ipld.Link, error)

type Option

type Option func(cfg *options) error

Option is an option configuring a publisher.

func WithAnnounceAddrs

func WithAnnounceAddrs(addrs ...string) Option

WithAnnounceAddrs configures the multiaddrs that are put into announce messages to tell indexers the addresses to fetch advertisements from.

func WithDirectAnnounce

func WithDirectAnnounce(announceURLs ...string) Option

WithDirectAnnounce sets indexer URLs to send direct HTTP announcements to.

func WithTopic

func WithTopic(topic string) Option

type Publisher

type Publisher interface {
	// Publish creates, signs and publishes an advert. It then announces the new
	// advert to other indexers.
	Publish(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[mh.Multihash], meta metadata.Metadata) (ipld.Link, error)
}

Jump to

Keyboard shortcuts

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