Documentation
¶
Overview ¶
Package source reads the files of a knowledge collection. A scan keeps the captured root open and never follows a link out of it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
Document *Document
Path string
Cached bool
Reason string
Excluded bool
Failed bool
Directory bool
}
Entry is one scanned file: an extracted Document, a file whose stamp the index still holds (Cached), or a skipped path with its Reason. Excluded skips are protected or ignored paths and are not counted. Failed marks a path that could not be read now and may be readable later, unlike a skip, which its content decides; Directory tells that everything below it was not visited.
type OCR ¶
type OCR struct {
Signature func() ([32]byte, error)
Parts func(ctx context.Context, name string, data []byte) ([]office.Part, error)
}
OCR reads images and scanned PDF pages. Signature identifies the selected model, or is zero when OCR is not configured.
type Part ¶
type Part struct {
Title, Text string
Position protocol.KnowledgePosition
}
Part is one positioned text of a document.
type Scan ¶
type Scan struct {
// contains filtered or unexported fields
}
Scan walks one source depth first.
func Controller ¶
Controller scans a directory or file a controller registered by its absolute path. Locators keep the registered spelling.
func (*Scan) Next ¶
func (scan *Scan) Next(reuse func(path string, stat Stat) (bool, error), watch func([]Watch)) (*Entry, error)
Next returns the next entry, or nil at the end. reuse reports a file whose stamp the index still holds; watch receives directories as they are found, before their files are read.
func (*Scan) TakeWatches ¶
TakeWatches returns the directories discovered since the last call.
type Stat ¶
type Stat struct {
Size uint64
ModifiedSeconds uint64
ModifiedNanos uint32
// Extractor identifies the OCR model for files it reads, zeros otherwise.
Extractor [32]byte
}
Stat is the metadata witness that lets an unchanged file skip extraction.