resource

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHttpTimeout = time.Second * 20
)

Variables

This section is empty.

Functions

func ETag added in v1.18.9

func ETag() bool

func SetETag added in v1.18.9

func SetETag(b bool)

Types

type Fetcher

type Fetcher[V any] struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher[V any](name string, interval time.Duration, vehicle types.Vehicle, parser Parser[V], onUpdate func(V)) *Fetcher[V]

func (*Fetcher[V]) Close added in v1.18.8

func (f *Fetcher[V]) Close() error

func (*Fetcher[V]) Initial

func (f *Fetcher[V]) Initial() (V, error)

func (*Fetcher[V]) Name

func (f *Fetcher[V]) Name() string

func (*Fetcher[V]) SideUpdate added in v1.18.8

func (f *Fetcher[V]) SideUpdate(buf []byte) (V, bool, error)

func (*Fetcher[V]) Update

func (f *Fetcher[V]) Update() (V, bool, error)

func (*Fetcher[V]) UpdatedAt

func (f *Fetcher[V]) UpdatedAt() time.Time

func (*Fetcher[V]) Vehicle

func (f *Fetcher[V]) Vehicle() types.Vehicle

func (*Fetcher[V]) VehicleType

func (f *Fetcher[V]) VehicleType() types.VehicleType

type FileVehicle

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

func NewFileVehicle

func NewFileVehicle(path string) *FileVehicle

func (*FileVehicle) Path

func (f *FileVehicle) Path() string

func (*FileVehicle) Proxy added in v1.18.4

func (f *FileVehicle) Proxy() string

func (*FileVehicle) Read

func (f *FileVehicle) Read(ctx context.Context, oldHash utils.HashType) (buf []byte, hash utils.HashType, err error)

func (*FileVehicle) Type

func (f *FileVehicle) Type() types.VehicleType

func (*FileVehicle) Url added in v1.18.9

func (f *FileVehicle) Url() string

func (*FileVehicle) Write added in v1.18.9

func (f *FileVehicle) Write(buf []byte) error

type HTTPVehicle

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

func NewHTTPVehicle

func NewHTTPVehicle(url string, path string, proxy string, header http.Header, timeout time.Duration, sizeLimit int64) *HTTPVehicle

func (*HTTPVehicle) Path

func (h *HTTPVehicle) Path() string

func (*HTTPVehicle) Proxy added in v1.18.4

func (h *HTTPVehicle) Proxy() string

func (*HTTPVehicle) Read

func (h *HTTPVehicle) Read(ctx context.Context, oldHash utils.HashType) (buf []byte, hash utils.HashType, err error)

func (*HTTPVehicle) SetProvider added in v1.18.10

func (h *HTTPVehicle) SetProvider(provider types.ProxyProvider)

func (*HTTPVehicle) Type

func (h *HTTPVehicle) Type() types.VehicleType

func (*HTTPVehicle) Url

func (h *HTTPVehicle) Url() string

func (*HTTPVehicle) Write added in v1.18.9

func (h *HTTPVehicle) Write(buf []byte) error

type Parser

type Parser[V any] func([]byte) (V, error)

Jump to

Keyboard shortcuts

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