Documentation ¶
Index ¶
- func InstrumentClient(client *http.Client) *http.Client
- func RegisterMetrics(reg prometheus.Registerer)
- func ResetMetrics()
- func SelectContent(contentBytes []byte, selectorExpression string) ([]byte, error)
- type DocumentController
- type DocumentWorkTask
- type DocumentWorker
- type Download
- type DownloadController
- type DownloadTask
- type GenericReader
- type NodeContentProcessor
- type Options
- type Reactor
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstrumentClient ¶
InstrumentClient instruments the client provided as argument to measure and report networking metrics
func RegisterMetrics ¶
func RegisterMetrics(reg prometheus.Registerer)
RegisterMetrics registers the http client metrics. The second parameter `reg` can be used to provide a custom registry, e.g. for tests.
Types ¶
type DocumentController ¶ added in v0.2.0
type DocumentController interface { jobs.Controller // SetDownloadScope sets the scope for respurces considered "local" // and therefore downloaded and relatively linked SetDownloadScope(scope *localityDomain) // GetDownloadController is accessor for the DownloadController // working with this DocumentController GetDownloadController() DownloadController }
DocumentController is the functional interface for a controller handling tasks for processing enqued documents. It ammends the jobs.Controller interface with specific methods.
func NewDocumentController ¶ added in v0.2.0
func NewDocumentController(worker *DocumentWorker, workersCount int, failfast bool) DocumentController
NewDocumentController creates a controller for processing documents.
type DocumentWorkTask ¶
DocumentWorkTask implements jobs#Task
type DocumentWorker ¶
type DocumentWorker struct { writers.Writer Reader processors.Processor NodeContentProcessor *NodeContentProcessor // contains filtered or unexported fields }
DocumentWorker implements jobs#Worker
func (*DocumentWorker) Work ¶
func (w *DocumentWorker) Work(ctx context.Context, task interface{}, wq jobs.WorkQueue) *jobs.WorkerError
Work implements Worker#Work function
type Download ¶ added in v0.2.0
type Download struct {
// contains filtered or unexported fields
}
Download represents a resource that can be downloaded
type DownloadController ¶ added in v0.2.0
type DownloadController interface { jobs.Controller // Schedule is a typesafe wrtapper around Controller#Enqueue // for enquing download tasks Schedule(ctx context.Context, link, resourceName string) }
DownloadController encapsulates activities for asyncronous and parallel scheduling and download of resources
func NewDownloadController ¶ added in v0.2.0
func NewDownloadController(reader Reader, writer writers.Writer, workersCount int, failFast bool, rhs resourcehandlers.Registry) DownloadController
NewDownloadController creates DownloadController object
type DownloadTask ¶
DownloadTask holds information for source and target of linked document resources
type GenericReader ¶
type GenericReader struct {
ResourceHandlers resourcehandlers.Registry
}
GenericReader is generic implementation for Reader interface
type NodeContentProcessor ¶
type NodeContentProcessor struct { DownloadController DownloadController ResourceHandlers resourcehandlers.Registry // contains filtered or unexported fields }
NodeContentProcessor operates on documents content to reconcile links and schedule linked resources downloads
func NewNodeContentProcessor ¶
func NewNodeContentProcessor(resourcesRoot string, ld *localityDomain, downloadJob DownloadController, failFast bool, markdownFmt bool, resourceHandlers resourcehandlers.Registry) *NodeContentProcessor
NewNodeContentProcessor creates NodeContentProcessor objects
func (*NodeContentProcessor) ReconcileLinks ¶
func (c *NodeContentProcessor) ReconcileLinks(ctx context.Context, node *api.Node, contentSourcePath string, documentBlob []byte) ([]byte, error)
ReconcileLinks analyzes a document referenced by a node's contentSourcePath and processes its links to other resources to resolve their inconsistencies. The processing might involve rewriting links to relative and having new destinations, or rewriting them to absolute, as well as downloading some of the linked resources. The function returns the processed document or error.
type Options ¶
type Options struct { MaxWorkersCount int MinWorkersCount int FailFast bool DestinationPath string ResourcesPath string ResourceDownloadWorkersCount int MarkdownFmt bool processors.Processor ResourceDownloadWriter writers.Writer Writer writers.Writer ResourceHandlers []resourcehandlers.ResourceHandler DryRunWriter writers.DryRunWriter Resolve bool }
Options encapsulates the parameters for creating new Reactor objects wiht NewReactor
type Reactor ¶
type Reactor struct { FailFast bool ResourceHandlers resourcehandlers.Registry DocController DocumentController DownloadController DownloadController DryRunWriter writers.DryRunWriter Resolve bool // contains filtered or unexported fields }
Reactor orchestrates the documentation build workflow
func (*Reactor) Build ¶
func (r *Reactor) Build(ctx context.Context, documentationRoot *api.Node, localityDomain *localityDomain) error
Build starts the build operation for a document structure root in a locality domain
func (*Reactor) ResolveStructure ¶ added in v0.3.0
ResolveStructure builds the subnodes hierarchy of a node based on the natural nodes hierarchy and on rules such as those in NodeSelector. The node hierarchy is resolved by an appropriate handler selected based on the NodeSelector path URI The resulting model is the actual flight plan for replicating resources.