construct

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option configures how the node is construct

func SkipNotification

func SkipNotification() Option

SkipNotification removes setting up IPNI notification handlers

func WithCachingQueue

func WithCachingQueue(cachingQueue blobindexlookup.CachingQueue) Option

WithCachingQueue overrides the default caching queue for provider caching

func WithClaimsClient

func WithClaimsClient(client redis.Client) Option

WithClaimsClient configures the redis client used for caching content claims.

func WithClaimsStore

func WithClaimsStore(store types.ContentClaimsStore) Option

WithClaimsStore configures the store used for content claims.

func WithDataPath

func WithDataPath(dataPath string) Option

WithDataPath constructs a flat FS datastore at the specified path to use for IPNI advertisements and content claims.

func WithDatastore

func WithDatastore(ds datastore.Batching) Option

WithDatastore uses the given datastore for storing IPNI advertisements and content claims.

func WithIndexesClient

func WithIndexesClient(client redis.Client) Option

WithIndexesClient configures the redis client used for caching blob indexes.

func WithLegacyClaims

func WithLegacyClaims(legacyClaims providerindex.LegacyClaimsFinder) Option

WithLegacyClaims uses the given LegacyClaimsFinder to find claims on legacy systems and storage

func WithProvidersClient

func WithProvidersClient(client redis.Client) Option

WithProvidersClient configures the redis client used for caching providers.

func WithPublisherStore

func WithPublisherStore(publisherStore store.PublisherStore) Option

WithPublisherStore overrides the store used for IPNI advertisements If not used with startIPNIServer = false, store.AdvertStore must implement store.FullStore

func WithServiceOptions

func WithServiceOptions(opts ...service.Option) Option

WithServiceOptions passes option to the core service

func WithStartIPNIServer

func WithStartIPNIServer(startIPNIServer bool) Option

WithStartIPNIServer determines when IPNI ads will be served directly over HTTP Defaults true

type Service

type Service interface {
	types.Service
	Startup(ctx context.Context) error
	Shutdown(ctx context.Context) error
}

Service is the core methods of the indexing service but with additional lifecycle methods.

func Construct

func Construct(sc ServiceConfig, opts ...Option) (Service, error)

Construct constructs a full operational indexing service, using real dependencies

type ServiceConfig

type ServiceConfig struct {

	// PrivateKey configures the private key for the service.
	PrivateKey crypto.PrivKey

	// PublicURL is the public HTTP URL(s) the indexing service is available at.
	// These are used when publishing claims, to indicate that they can be
	// retrieved from here, replacing the pattern "{claim}" with the CID of the
	// claim that is available.
	PublicURL []string

	ProvidersRedis goredis.Options
	ClaimsRedis    goredis.Options
	IndexesRedis   goredis.Options

	// IndexerURL is the URL of an IPNI node to use for find queries.
	IndexerURL string

	// PublisherDirectAnnounceURLs are the URL(s) of IPNI nodes that advertisement
	// announcements should be sent to. Defaults to IndexerURL if not set.
	PublisherDirectAnnounceURLs []string
	// PublisherListenAddr configures the HTTP address the publisher binds to.
	// This allows a remote IPNI subscriber to fetch advertisements.
	PublisherListenAddr string
	// PublisherAnnounceAddrs configures the multiaddrs that are put into announce
	// messages to tell indexers the addresses to fetch advertisements from.
	PublisherAnnounceAddrs []string
}

ServiceConfig sets specific config values for the service

Jump to

Keyboard shortcuts

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