Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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)
New creates a new IPNI publisher. IPNIPublisher is not safe for concurrent use. There is the risk of losing advertisements if Publish is called from concurrent goroutines. If you will be publishing from multiple goroutines concurrently, a synchronization mechanism (such as sync.Mutex) must be used to ensure that Publish is called serially.
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)
Publish creates a new advertisement from the latest head, signs it, and publishes it. Publish is not safe for concurrent use and advertisements may be lost if called concurrently. A mutex or any other synchronization mechanism must be used around Publish if it will be called from concurrent goroutines.
type Option ¶
type Option func(cfg *options) error
Option is an option configuring a publisher.
func WithAnnounceAddrs ¶
WithAnnounceAddrs configures the multiaddrs that are put into announce messages to tell indexers the addresses to fetch advertisements from.
func WithDirectAnnounce ¶
WithDirectAnnounce sets indexer URLs to send direct HTTP announcements to.