construct

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0, MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHTTPClient

func DefaultHTTPClient() *http.Client

DefaultHTTPClient creates a HTTP client with sensible defaults

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 WithAsyncPublisher added in v1.10.6

func WithAsyncPublisher(asyncPublisher publisher.AsyncPublisher) Option

WithAsyncPublisher overrides the default IPNI publisher

func WithCachingQueue

func WithCachingQueue(cachingQueue providercacher.CachingQueueQueuer) Option

WithCachingQueue overrides the default caching queue for provider caching

func WithClaimsCacheOptions

func WithClaimsCacheOptions(opts ...redis.Option) Option

WithClaimsCacheOptions passes configuration to the providers cache

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 WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient configures the HTTP client used when consuming HTTP APIs

func WithIndexesCacheOptions

func WithIndexesCacheOptions(opts ...redis.Option) Option

WithIndexesCacheOptions passes configuration to the providers cache

func WithIndexesClient

func WithIndexesClient(client redis.Client) Option

WithIndexesClient configures the redis client used for caching blob indexes.

func WithLegacyClaims

func WithLegacyClaims(legacyClaimsMappers []legacy.ContentToClaimsMapper, legacyClaimsBucket types.ContentClaimsStore, legacyClaimsUrl string) Option

WithLegacyClaims configures the service to find claims on legacy systems and storage

func WithNoProvidersCacheOptions

func WithNoProvidersCacheOptions(opts ...redis.Option) Option

WithNoProvidersCacheOptions passes configuration to the no providers cache

func WithNoProvidersClient

func WithNoProvidersClient(client redis.Client) Option

WithNoProvidersClient configures the redis client used for caching empty provider results

func WithProviderIndexLogger

func WithProviderIndexLogger(log logging.EventLogger) Option

func WithProvidersCacheOptions

func WithProvidersCacheOptions(opts ...redis.Option) Option

WithProvidersCacheOptions passes configuration to the providers cache

func WithProvidersClient

func WithProvidersClient(client redis.PipelineClient) 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 {
	// ID configures the identity for the service. Both ID and PrivateKey are the
	// same key, the difference is that ID may be wrapped as a did:web.
	ID principal.Signer

	// 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.ClusterOptions
	NoProviderRedis goredis.ClusterOptions
	ClaimsRedis     goredis.ClusterOptions
	IndexesRedis    goredis.ClusterOptions

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

	// IPNIDirectAnnounceURLs are the URL(s) of IPNI nodes that
	// advertisement announcements should be sent to. Defaults to IndexerURL if
	// not set.
	IPNIDirectAnnounceURLs []string
	// IPNIListenAddr configures the HTTP address the publisher binds to.
	// This allows a remote IPNI subscriber to fetch advertisements.
	IPNIListenAddr string
	// IPNIAnnounceAddrs configures the multiaddrs that are put into announce
	// messages to tell indexers the addresses to fetch advertisements from.
	IPNIAnnounceAddrs []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