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 DocumentWorkTask
- type DocumentWorker
- type DownloadJob
- type DownloadTask
- type GenericReader
- type NodeContentProcessor
- type Options
- type Reactor
- type Reader
- type ResourceDownloadJob
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 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{}) *jobs.WorkerError
Work implements Worker#Work function
type DownloadJob ¶
type DownloadJob interface { Start(ctx context.Context, errCh chan error, shutdownCh chan struct{}, wg *sync.WaitGroup) Schedule(ctx context.Context, link, resourceName string) }
DownloadJob encapsulates activities for asyncronous and parallel scheduling and download of resources
func NewResourceDownloadJob ¶
func NewResourceDownloadJob(reader Reader, writer writers.Writer, workersCount int, failFast bool, rhs resourcehandlers.Registry) DownloadJob
NewResourceDownloadJob creates DownloadJob 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 { DownloadJob DownloadJob 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 DownloadJob, 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 }
Options encapsulates the parameters for creating new Reactor objects wiht NewReactor
type Reactor ¶
type Reactor struct { ReplicateDocumentation *jobs.Job FailFast bool ResourceHandlers resourcehandlers.Registry // 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) Resolve ¶
Resolve 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.
type ResourceDownloadJob ¶
type ResourceDownloadJob struct {
// contains filtered or unexported fields
}
ResourceDownloadJob implements reactor#DownloadJob