Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options) error
Option represents a configurable parameter in a publisher.
func WithBootstrapPeers ¶
WithBootstrapPeers optionally sets the list of peers to which to remain connected. If unset, no bootstrapping will be performed.
See: bootstrap.DefaultBootstrapConfig
func WithExternalAddrs ¶ added in v0.0.47
func WithExternalAddrs(addrs []multiaddr.Multiaddr) Option
WithExternalAddrs sets the addresses to include in published legs messages as the address on which the hsot can be reached. Defaults to host listen addresses.
type PandoPublisher ¶
type PandoPublisher struct {
// contains filtered or unexported fields
}
func (*PandoPublisher) Publish ¶
func (p *PandoPublisher) Publish(ctx context.Context, c cid.Cid) error
Publish wraps the given CID into a Pando metadata instance and announces the CID of resulting metadata.
The metadata produced, simply uses the byte value of the given CID as payload of the Pando metadata schema. See: https://github.com/kenlabs/pando
Note that the given CID must be preset in the store passed to the publisher at initialization.
type Publisher ¶
type Publisher interface { Start(context.Context) error Publish(context.Context, cid.Cid) error Shutdown(context.Context) error }
func NewPandoPublisher ¶
func NewPandoPublisher(ds datastore.Batching, store storage.ReadableStorage, o ...Option) (Publisher, error)
NewPandoPublisher instantiates a new publisher that publishes announcements compatible with the Pando service by wrapping the CID of the original data within a Pando's metadata instance.
A user may call PandoPublisher.Publish with the CID of original data to produce one such announcement. Note that any CID passed to PandoPublisher.Publish must be available to read via the given store. See: PandoPublisher.Publish.
This publisher must be started via PandoPublisher.Start prior to use and shut down when no longer needed via PandoPublisher.Shutdown.
The ds datastore is used internally by the publisher and is not closed upon shutdown.