indexer

package
v0.0.0-...-efe2ce5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxEventSliceLength = 1000000
View Source
const MaxOpsSliceLength = 200

Variables

This section is empty.

Functions

This section is empty.

Types

type CrawlDispatcher

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

func NewCrawlDispatcher

func NewCrawlDispatcher(repoFn func(context.Context, *crawlWork) error, concurrency int) (*CrawlDispatcher, error)

func (*CrawlDispatcher) AddToCatchupQueue

func (*CrawlDispatcher) Crawl

func (c *CrawlDispatcher) Crawl(ctx context.Context, ai *models.ActorInfo) error

func (*CrawlDispatcher) RepoInSlowPath

func (c *CrawlDispatcher) RepoInSlowPath(ctx context.Context, uid models.Uid) bool

func (*CrawlDispatcher) Run

func (c *CrawlDispatcher) Run()

type DidResolver

type DidResolver interface {
	GetDocument(ctx context.Context, didstr string) (*did.Document, error)
}

type Indexer

type Indexer struct {
	Crawler *CrawlDispatcher

	SendRemoteFollow       func(context.Context, string, uint) error
	CreateExternalUser     func(context.Context, string) (*models.ActorInfo, error)
	ApplyPDSClientSettings func(*xrpc.Client)
	// contains filtered or unexported fields
}

func NewIndexer

func NewIndexer(db *gorm.DB, notifman notifs.NotificationManager, evtman *events.EventManager, didr did.Resolver, fetcher *RepoFetcher, crawl, aggregate, spider bool) (*Indexer, error)

func (*Indexer) DidForUser

func (ix *Indexer) DidForUser(ctx context.Context, uid models.Uid) (string, error)

func (*Indexer) GetPost

func (ix *Indexer) GetPost(ctx context.Context, uri string) (*models.FeedPost, error)

func (*Indexer) GetPostOrMissing

func (ix *Indexer) GetPostOrMissing(ctx context.Context, uri string) (*models.FeedPost, error)

func (*Indexer) GetUserOrMissing

func (ix *Indexer) GetUserOrMissing(ctx context.Context, did string) (*models.ActorInfo, error)

func (*Indexer) HandleRepoEvent

func (ix *Indexer) HandleRepoEvent(ctx context.Context, evt *repomgr.RepoEvent) error

func (*Indexer) LookupUser

func (ix *Indexer) LookupUser(ctx context.Context, id models.Uid) (*models.ActorInfo, error)

func (*Indexer) LookupUserByDid

func (ix *Indexer) LookupUserByDid(ctx context.Context, did string) (*models.ActorInfo, error)

func (*Indexer) LookupUserByHandle

func (ix *Indexer) LookupUserByHandle(ctx context.Context, handle string) (*models.ActorInfo, error)

type KeyManager

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

func NewKeyManager

func NewKeyManager(didr DidResolver, k *did.PrivKey) *KeyManager

func (*KeyManager) SignForUser

func (km *KeyManager) SignForUser(ctx context.Context, did string, msg []byte) ([]byte, error)

func (*KeyManager) VerifyUserSignature

func (km *KeyManager) VerifyUserSignature(ctx context.Context, did string, sig []byte, msg []byte) error

type RepoFetcher

type RepoFetcher struct {
	Limiters map[uint]*rate.Limiter
	LimitMux sync.RWMutex

	MaxConcurrency int

	ApplyPDSClientSettings func(*xrpc.Client)
	// contains filtered or unexported fields
}

func NewRepoFetcher

func NewRepoFetcher(db *gorm.DB, rm *repomgr.RepoManager, maxConcurrency int) *RepoFetcher

func (*RepoFetcher) FetchAndIndexRepo

func (rf *RepoFetcher) FetchAndIndexRepo(ctx context.Context, job *crawlWork) error

TODO: since this function is the only place we depend on the repomanager, i wonder if this should be wired some other way?

func (*RepoFetcher) GetLimiter

func (rf *RepoFetcher) GetLimiter(pdsID uint) *rate.Limiter

func (*RepoFetcher) GetOrCreateLimiter

func (rf *RepoFetcher) GetOrCreateLimiter(pdsID uint, pdsrate float64) *rate.Limiter

func (*RepoFetcher) SetLimiter

func (rf *RepoFetcher) SetLimiter(pdsID uint, lim *rate.Limiter)

Jump to

Keyboard shortcuts

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