pagerank

package
v0.0.0-...-02f51c9 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// API for querying with the links and edges data store.
	GraphAPI GraphAPI

	// API for communicating with the index store.
	IndexAPI IndexAPI

	// An API for detecting partition assignments for this service.
	PartitionDetector partition.Detector

	// A clock instance for generating time-related events. If not specified,
	// the default wall-clock will be used instead.
	Clock clock.Clock

	// The number of workers to spin up for computing PageRank scores. If
	// not specified, a default value of 1 will be used instead.
	NumOfComputeWorkers int

	// The duration between subsequent page-rank passes.
	UpdateInterval time.Duration

	// The logger to use. If not defined an output-discarding logger will
	// be used instead.
	Logger *logrus.Entry
}

Config defines configurations for the page-ranking service.

type GraphAPI

type GraphAPI interface {
	// Links returns an iterator for a set of links whose id's belong
	// to the [fromID, toID] range and were retrieved before the [retrievedBefore]
	// time.
	Links(fromID, toID uuid.UUID, retrievedBefore time.Time) (graph.LinkIterator, error)

	// Edges returns an iterator for a set of edges whose source vertex id's
	// belong to the [fromID, toID] range and were updated before the
	// [updatedBefore] time.
	Edges(fromID, toID uuid.UUID, updatedBefore time.Time) (graph.EdgeIterator, error)
}

GraphAPI defines a minimum set of API methods for querying the link graph store.

type IndexAPI

type IndexAPI interface {
	// UpdateScore updates the PageRank score for a document with the
	// specified link ID. If no such document exists, a placeholder
	// document with the provided score will be created.
	UpdateScore(linkID uuid.UUID, score float64) error
}

IndexAPI defines a minimum set of API methods for updating indexed documents.

type Service

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

Service represents a page-rank service for the uSearch application. it satisfies the service.Service interface.

func New

func New(config Config) (*Service, error)

New creates and returns a fully configured page-rank service instance.

func (*Service) Name

func (svc *Service) Name() string

Name returns the name of the service.

func (*Service) Run

func (svc *Service) Run(ctx context.Context) error

Run executes the service and blocks until the context gets cancelled or an error occurs.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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