updater

package
v0.0.0-...-7b4befc Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServerHasNotEnoughInformation = errors.New("server has not enough information")

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Info(s string)
	Warn(s string)
	Error(s string)
}

type Provider

type Provider interface {
	Name() string
	FetchServers(ctx context.Context, minServers int) (servers []models.Server, err error)
}

type Providers

type Providers interface {
	Get(providerName string) provider.Provider
}

type Storage

type Storage interface {
	SetServers(provider string, servers []models.Server) (err error)
	GetServersCount(provider string) (count int)
	ServersAreEqual(provider string, servers []models.Server) (equal bool)
	// Extra methods to match the provider.New storage interface
	FilterServers(provider string, selection settings.ServerSelection) (filtered []models.Server, err error)
	GetServerByName(provider string, name string) (server models.Server, ok bool)
}

type Unzipper

type Unzipper interface {
	FetchAndExtract(ctx context.Context, url string) (
		contents map[string][]byte, err error)
}

type Updater

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

func New

func New(httpClient *http.Client, storage Storage,
	providers Providers, logger Logger) *Updater

func (*Updater) UpdateServers

func (u *Updater) UpdateServers(ctx context.Context, providers []string,
	minRatio float64) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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