router

package
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntegrationStatus

type IntegrationStatus string

IntegrationStatus represents the status of a fetcher integration test

const (
	MissingFetcher           IntegrationStatus = "MISSING FETCHER"
	SourceDown               IntegrationStatus = "SOURCE DOWN"
	InvalidCredentials       IntegrationStatus = "INVALID CREDENTIALS"
	MissingRemoteResource    IntegrationStatus = "MISSING REMOTE RESOURCE"
	MismatchedRemoteResource IntegrationStatus = "MISMATCHED REMOTE RESOURCE"
	MissingLocalResource     IntegrationStatus = "MISSING LOCAL RESOURCE"
	IntegrationFailure       IntegrationStatus = "INTEGRATION FAILURE"
	IntegrationSuccess       IntegrationStatus = "INTEGRATION SUCCESS"
)

Integration statuses

type Router

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

Router routes URLs to fetchers

func EnvConfigured

func EnvConfigured(chromePath func() string) *Router

EnvConfigured creates a new router with default builders configured for environment variables

func New

func New(opts reqx.Options) *Router

New creates a new router with the given options

func (*Router) CheckIntegration

func (r *Router) CheckIntegration(sourceID source.ID) IntegrationStatus

CheckIntegration checks the integration status of a given source

func (*Router) Fetchers

func (r *Router) Fetchers() []fetcher.Fetcher

Fetchers returns the list of fetchers registered with the router

func (*Router) RegisterBuilder

func (r *Router) RegisterBuilder(builder fetcher.Builder)

RegisterBuilder registers a builder with the router

func (*Router) RegisterBuilders

func (r *Router) RegisterBuilders(builders ...fetcher.Builder)

RegisterBuilders registers multiple builders with the router

func (*Router) RegisterFetcher

func (r *Router) RegisterFetcher(fetcher fetcher.Fetcher)

RegisterFetcher registers a fetcher with the router

func (*Router) RegisterFetchers

func (r *Router) RegisterFetchers(fetchers ...fetcher.Fetcher)

RegisterFetchers registers multiple fetchers with the router

func (*Router) Sources

func (r *Router) Sources() []source.ID

Sources returns the list of sources registered with the router

func (*Router) TaskMapOf

func (r *Router) TaskMapOf(urls ...string) TaskBucket

TaskMapOf creates a map of tasks for the given URLs (indexed by normalized URL)

func (*Router) TaskOf

func (r *Router) TaskOf(url string) (task.Task, bool)

TaskOf tries to create a task for the given URL using the fetcher with the shortest base URL

func (*Router) TaskSliceOf

func (r *Router) TaskSliceOf(urls ...string) TaskSlice

TaskSliceOf creates a slice of tasks for the given URLs

type TaskBucket

type TaskBucket struct {
	Tasks       map[string]task.Task
	ValidURLs   []string
	InvalidURLs []string
}

TaskBucket represents a collection of tasks for a given set of URLs (indexed by normalized URL)

type TaskSlice

type TaskSlice struct {
	Tasks       []task.Task
	ValidURLs   []string
	InvalidURLs []string
}

TaskSlice represents a collection of tasks

Jump to

Keyboard shortcuts

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