generic

package
v0.0.0-...-f2d6d67 Latest Latest
Warning

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

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

Documentation

Overview

Package generic implements a generic provider that can fetch an url and grap the picture form an XPath

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	LivenessCheck    time.Duration `env:"LIVENESS_CHECK,default=5m"`
	ProbeTimeout     time.Duration `env:"PROBE_TIMEOUT,default=60m"`
	HTTPTimeout      time.Duration `env:"HTTP_TIMEOUT,default=10s"`
	TransportTimeout time.Duration `env:"TRANSPORT_TIMEOUT,default=5s"`
	URL              *url.URL      `env:"URL,required"`
	Path             string        `env:"XPATH"`
	Mode             string        `env:"MODE,default=center"` // fill is possible
	Scale            float64       `env:"SCALE, default=1"`
	// contains filtered or unexported fields
}

Provider provider

func (*Provider) Configure

func (c *Provider) Configure(ctx context.Context) error

Configure the provider with environment variables

func (*Provider) Fetch

func (c *Provider) Fetch(ctx context.Context) (image.Image, error)

Fetch an image. It returns any error that prevents the image to be downloaded

func (*Provider) Process

func (p *Provider) Process(ctx context.Context, img image.Image) (image.Image, error)

Process the picture ...

func (*Provider) WaitOnline

func (c *Provider) WaitOnline(ctx context.Context) error

WaitOnline check if the service is online, every tick; it returns when the service is up StartProbe only returns when the provider is reachable or in case of context cancelation

Jump to

Keyboard shortcuts

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