vautour

package
v0.0.0-...-64062e4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("document already exists")

Functions

func Boot

func Boot(cfg Config)

Types

type Config

type Config struct {
	Modules map[string]*modules.ModuleConfig

	Inputs     InputsConfig
	Queues     QueuesConfig
	Scrapers   ScrapersConfig
	Processors ProcessorsConfig
	Outputs    OutputsConfig
}

type Document

type Document struct {
	ID      string
	Title   string
	User    string `json:",omitempty"`
	Size    int
	URL     string
	Content []byte

	CreatedAt time.Time
	ExpireAt  time.Time

	Score     int
	Processed []ProcessedData `json:",omitempty"`

	// Internally managed //
	InputModuleName string
}

func NewDocumentFromJSON

func NewDocumentFromJSON(s string) (*Document, error)

func (*Document) JSON

func (d *Document) JSON() string

type InputModule

type InputModule interface {
	Configure(*modules.ModuleConfig) error
	List(*stopper.Stopper, chan *Document) error
	Scrape(*Document) error
}

type InputsConfig

type InputsConfig struct {
	Modules []string
}

type OutputModule

type OutputModule interface {
	Configure(*modules.ModuleConfig) error
	Send(*Document) error
}

type OutputsConfig

type OutputsConfig struct {
	Modules []string
	Threads int
}

type ProcessedData

type ProcessedData struct {
	Module string
	json.RawMessage
}

type ProcessorModule

type ProcessorModule interface {
	Configure(*modules.ModuleConfig) error
	Process(*Document) error
}

type ProcessorsConfig

type ProcessorsConfig struct {
	Modules []string
	Threads int
}

type QueueModule

type QueueModule interface {
	Configure(moduleConfig *modules.ModuleConfig) error
	AddDocument(queue string, d *Document, cacheTTL time.Duration) error
	GetDocument(queue string, ttl time.Duration) (string, *Document, func(time.Duration) error, error)
	ReleaseDocument(queue string, d *Document) error
	DeleteDocument(queue string, d *Document) error
	Bookkeep(queues []string)
}

type QueuesConfig

type QueuesConfig struct {
	Module string
}

type ScrapersConfig

type ScrapersConfig struct {
	Modules []string
	Threads int
}

Jump to

Keyboard shortcuts

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