reaper

package
v0.8.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotFound = errors.New("provider not found")
	ErrNoCarReader      = errors.New("car reader not available")
)

Functions

func ArchiveName

func ArchiveName(providerID peer.ID) string

Types

type GCAd

type GCAd struct {
	Previous  cid.Cid
	ContextID string
	Entries   cid.Cid
}

type GCState

type GCState struct {
	LastProcessedAdCid cid.Cid
}

type GCStats

type GCStats struct {
	AdsProcessed    int
	CarsDataSize    int64
	CarsRemoved     int
	CtxIDsKept      int
	CtxIDsRemoved   int
	EmptyAds        int
	IndexAdsKept    int
	IndexAdsRemoved int
	IndexesRemoved  int
	RemovalAds      int
	ReusedCtxIDs    int
	TimeElapsed     time.Duration
}

func (GCStats) String

func (s GCStats) String() string

type Option

type Option func(*config) error

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

func WithCarCompress

func WithCarCompress(alg string) Option

WithCarCompress configures CAR file compression.

func WithCarDelete

func WithCarDelete(del bool) Option

WithCarDelete deletes CAR files that have no multihash content, including CAR file for removal and address update advertisements.

func WithCarRead

func WithCarRead(rd bool) Option

WithCarRead sets whether or not entries are read from CAR files. Only set to false if CAR file exist, but do not contain needed entries data.

func WithDatastoreDir

func WithDatastoreDir(dir string) Option

WithDatastoreDir tells GC the directory to use as the parent for all provider-specific datastores.

func WithDatastoreTempDir

func WithDatastoreTempDir(dir string) Option

WithDatastoreTempDir tells GC the directory to use as the parent for all provider-specific temproary datastores.

func WithDeleteNotFound

func WithDeleteNotFound(dnf bool) Option

WithDeleteNotFound causes all index content for a provider to be deleted if that provider is not found in any of the sources of provider information.

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 WithEntriesFromPublisher

func WithEntriesFromPublisher(entsFromPub bool) Option

WithEntriesFromPublisher allows fetching advertisement entries from the publisher if they cannot be fetched from a CAR file.

func WithHttpTimeout

func WithHttpTimeout(to time.Duration) Option

WithHttpTimeout sets the timeout for http and libp2phttp connections.

func WithLibp2pHost

func WithLibp2pHost(h host.Host) Option

WithLibp2pHost configures gc to use an existing libp2p host to connect to publishers.

func WithPCache

func WithPCache(pc *pcache.ProviderCache) Option

func WithSegmentSize

func WithSegmentSize(size int) Option

WithSegmentSize sets the size of the segments that the ad chain is broken into for processing after syncing.

func WithSyncSegmentSize

func WithSyncSegmentSize(size int) Option

WithSyncSegmentSize sets sice that the ad chain is broken into when syncing.

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 Reaper

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

func New

func New(idxr indexer.Interface, fileStore filestore.Interface, options ...Option) (*Reaper, error)

func (*Reaper) AddStats

func (r *Reaper) AddStats(a GCStats)

func (*Reaper) ClearStats

func (r *Reaper) ClearStats()

func (*Reaper) Close

func (r *Reaper) Close()

func (*Reaper) Reap

func (r *Reaper) Reap(ctx context.Context, providerID peer.ID) error

func (*Reaper) Stats

func (r *Reaper) Stats() GCStats

Jump to

Keyboard shortcuts

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