adpub

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContentNotFound = errors.New("content not found at publisher")

Functions

This section is empty.

Types

type AdSample

type AdSample struct {
	IsRemove         bool
	NoLongerProvided bool

	PartiallySynced bool
	SyncErr         error
	ChunkCount      int
	MhCount         int
	MhSample        []multihash.Multihash
	// contains filtered or unexported fields
}

type AdStats

type AdStats struct {
	NonRmCount              int
	RmCount                 int
	AdNoLongerProvidedCount int
	// contains filtered or unexported fields
}

func NewAdStats

func NewAdStats(s Sampler) *AdStats

func (*AdStats) NonRmChunkStats

func (a *AdStats) NonRmChunkStats() stats.Float64Data

func (*AdStats) NonRmMhStats

func (a *AdStats) NonRmMhStats() stats.Float64Data

func (*AdStats) Print

func (a *AdStats) Print()

func (*AdStats) Sample

func (a *AdStats) Sample(ad *Advertisement) *AdSample

func (*AdStats) TotalAdCount

func (a *AdStats) TotalAdCount() int

func (*AdStats) UniqueContextIDCount

func (a *AdStats) UniqueContextIDCount() int
type Advertisement struct {
	ID               cid.Cid
	PreviousID       cid.Cid
	ProviderID       peer.ID
	ContextID        []byte
	Metadata         []byte
	Addresses        []string
	Entries          *EntriesIterator
	IsRemove         bool
	ExtendedProvider *schema.ExtendedProvider
	// SigErr is the signature validation error. Nil if signature is valid.
	SigErr error
	// SignerID is the peer.ID of the of the signer.
	SignerID peer.ID
}

Advertisement contains information about a schema.Advertisement

func (*Advertisement) HasEntries

func (a *Advertisement) HasEntries() bool

type Client

type Client interface {
	GetAdvertisement(context.Context, cid.Cid) (*Advertisement, error)
	Close() error
	List(context.Context, cid.Cid, int, io.Writer) error
	SyncEntriesWithRetry(context.Context, cid.Cid) error
}

func NewClient

func NewClient(addrInfo peer.AddrInfo, options ...Option) (Client, error)

NewClient creates a new client for a content advertisement publisher.

type ClientStore

type ClientStore struct {
	datastore.Batching
	ipld.LinkSystem
}

type EntriesIterator

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

func (*EntriesIterator) ChunkCount

func (d *EntriesIterator) ChunkCount() int

ChunkCount returns the number of current chunk in iteration. This function returns the final count of entries chunk when iteration reaches its end, i.e. calling EntriesIterator.Next returns io.EOF error.

func (*EntriesIterator) Drain

func (d *EntriesIterator) Drain() ([]multihash.Multihash, error)

func (*EntriesIterator) IsPresent

func (d *EntriesIterator) IsPresent() bool

func (*EntriesIterator) Next

func (d *EntriesIterator) Next() (multihash.Multihash, error)

func (*EntriesIterator) Root

func (d *EntriesIterator) Root() cid.Cid

type MultihashIterator

type MultihashIterator interface {
	// Next returns the next multihash in the list of mulitihashes.  The
	// iterator fails fast: errors that occur during iteration are returned
	// immediately.  This function returns a zero multihash and io.EOF when
	// there are no more elements to return.
	Next() (multihash.Multihash, error)
}

MultihashIterator iterates over a list of multihashes.

See: CarMultihashIterator.

type Option

type Option func(*config) error

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

func WithEntriesDepthLimit

func WithEntriesDepthLimit(depthLimit int64) Option

WithEntriesDepthLimit sets the depth limit when syncing an advertisement entries chain. Setting to 0 means no limit.

func WithHttpTimeout added in v0.1.6

func WithHttpTimeout(to time.Duration) Option

WithHttpTimeout sets the timeout for http and libp2phttp connections.

func WithLibp2pHost added in v0.0.11

func WithLibp2pHost(h host.Host) Option

WithLibp2pHost configures the client to use an existing libp2p host.

func WithMaxSyncRetry

func WithMaxSyncRetry(r uint64) Option

WithMaxSyncRetry sets the maximum number of times to retry a failed sync. Defaults to 10 if unset.

func WithSyncRetryBackoff

func WithSyncRetryBackoff(d time.Duration) Option

WithSyncRetryBackoff sets the length of time to wait before retrying a faild sync. Defaults to 500ms if unset.

func WithTopicName

func WithTopicName(topic string) Option

WithTopicName sets the topic name on which the provider announces advertised content. Defaults to '/indexer/ingest/mainnet'.

type Sampler

type Sampler func() bool

Jump to

Keyboard shortcuts

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