collect

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

func New

func New(processor Processor, opts *Options) (*Collector, error)

func (*Collector) Collect

func (c *Collector) Collect(req *Job) error

func (*Collector) Get

func (c *Collector) Get(id string) (io.ReadCloser, error)

func (*Collector) List

func (c *Collector) List() []*Entry

type Entry

type Entry struct {
	Snapshot *Snapshot
	Status   Status
	Message  string
}

type Job

type Job struct {
	URL      string
	Duration int
}

type Options

type Options struct {
	WorkDir   string
	FileName  string
	EventName string
	EventHub  *event.Hub
}

type Processor

type Processor interface {
	Process(snapshot *Snapshot) (io.ReadCloser, error)
	Cacheable() bool
}

type Snapshot

type Snapshot struct {
	SnapshotMeta
	SnapshotPath `json:"-"`
}

func (*Snapshot) Collect

func (s *Snapshot) Collect() error

func (*Snapshot) Prune

func (s *Snapshot) Prune() error

type SnapshotMeta

type SnapshotMeta struct {
	ID       string
	Datetime time.Time
	URL      string
	Duration int
}

type SnapshotPath

type SnapshotPath struct {
	Meta  string
	Body  string
	Cache string
}

type Status

type Status string
const (
	StatusOk      Status = "ok"
	StatusFail    Status = "fail"
	StatusPending Status = "pending"
)

type Storage

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

func (*Storage) List

func (s *Storage) List() ([]*Snapshot, error)

func (*Storage) PrepareSnapshot

func (s *Storage) PrepareSnapshot(url string, duration int) *Snapshot

Jump to

Keyboard shortcuts

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