internal

package
v0.0.0-...-eeac195 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = false
)
View Source
var (
	DefaultFetch = NewFetch()
)

Functions

func GetLogger

func GetLogger(funcName string) *log.Logger

func HashURL

func HashURL(url string) string

func ProcessSites

func ProcessSites(hosts *Hosts, sources *Sources, state *State, numFetches uint) error

Types

type Fetch

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

func NewFetch

func NewFetch() *Fetch

func (*Fetch) Hosts

func (f *Fetch) Hosts(url string) ([]string, error)

func (*Fetch) ResourceState

func (f *Fetch) ResourceState(url string) (ResourceState, error)

func (*Fetch) SetTimeout

func (f *Fetch) SetTimeout(timeout uint)

type Hosts

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

func NewHosts

func NewHosts() *Hosts

func (*Hosts) Add

func (h *Hosts) Add(newHosts []string)

func (*Hosts) Clear

func (h *Hosts) Clear()

func (*Hosts) DumpToConsole

func (h *Hosts) DumpToConsole()

func (*Hosts) DumpToFile

func (h *Hosts) DumpToFile(filename string) error

func (*Hosts) Hosts

func (h *Hosts) Hosts() []string

func (*Hosts) Len

func (h *Hosts) Len() uint

func (*Hosts) LoadCache

func (h *Hosts) LoadCache(cacheID string) error

func (*Hosts) SaveCache

func (h *Hosts) SaveCache(cacheID string) error

type ResourceState

type ResourceState struct {
	LastModified time.Time `json:"last-modified,omitempty"`
	ETag         string    `json:"etag,omitempty"`
}

func (ResourceState) IsETagStale

func (rs ResourceState) IsETagStale(sourceETag string) bool

func (ResourceState) IsEmpty

func (rs ResourceState) IsEmpty() bool

func (ResourceState) IsLastModifiedPast

func (rs ResourceState) IsLastModifiedPast(sourceLastModified time.Time) bool

func (ResourceState) String

func (rs ResourceState) String() string

type Sources

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

func NewSources

func NewSources() *Sources

func (*Sources) FromFile

func (s *Sources) FromFile(filename string) error

func (*Sources) Sources

func (s *Sources) Sources() map[string][]string

type State

type State map[string]ResourceState

func (*State) Get

func (st *State) Get(url string) ResourceState

func (*State) Load

func (st *State) Load() error

func (*State) Save

func (st *State) Save() error

func (*State) Set

func (st *State) Set(url string, newState ResourceState)

Jump to

Keyboard shortcuts

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