fetch

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FetchValidationResult added in v1.0.0

type FetchValidationResult struct {
	UploadTmpfile  string
	UploadFilename string
	Error          error
	Found          bool
	FeedVersionID  tt.Int
}

type FetchValidator added in v1.0.0

type FetchValidator interface {
	ValidateResponse(context.Context, tldb.Adapter, string, request.FetchResponse) (FetchValidationResult, error)
}

type Options

type Options struct {
	FeedURL         string
	FeedID          int
	URLType         string
	Storage         string
	AllowFTPFetch   bool
	AllowLocalFetch bool
	AllowS3Fetch    bool
	MaxSize         uint64
	HideURL         bool
	FetchedAt       time.Time
	Secrets         []dmfr.Secret
}

Options sets options for a fetch operation.

type RTFetchOptions added in v1.0.0

type RTFetchOptions struct {
	Options
}

type RTFetchResult

type RTFetchResult struct {
	Message *pb.FeedMessage
	Result
}

func RTFetch

func RTFetch(ctx context.Context, atx tldb.Adapter, opts RTFetchOptions) (RTFetchResult, error)

type RTFetchValidator added in v1.0.0

type RTFetchValidator struct {
	Result         RTFetchResult
	RTFetchOptions RTFetchOptions
}

func NewRTFetchValidator added in v1.0.0

func NewRTFetchValidator(opts RTFetchOptions) *RTFetchValidator

func (*RTFetchValidator) Fetch added in v1.0.0

func (*RTFetchValidator) ValidateResponse added in v1.0.0

type Result

type Result struct {
	Found          bool
	Error          error
	URL            string
	ResponseSize   int
	ResponseCode   int
	ResponseTtfbMs int
	ResponseTimeMs int
	ResponseSHA1   string
	FetchError     error
	FeedVersionID  tt.Int
}

Result contains results of a fetch operation.

func Fetch added in v1.0.0

func Fetch(ctx context.Context, atx tldb.Adapter, opts Options, cb FetchValidator) (Result, error)

Fetch and check for serious errors - regular errors are in fr.FetchError

type StaticFetchOptions added in v1.0.0

type StaticFetchOptions struct {
	StrictValidation        bool
	SaveValidationReport    bool
	ValidationReportStorage string
	ValidatorOptions        validator.Options
	CreatedBy               tt.String
	Name                    tt.String
	Description             tt.String
	Options
}

type StaticFetchResult

type StaticFetchResult struct {
	FeedVersion                *dmfr.FeedVersion
	FeedVersionValidatorResult *validator.Result
	Result
}

func StaticFetch

func StaticFetch(ctx context.Context, atx tldb.Adapter, opts StaticFetchOptions) (StaticFetchResult, error)

StaticFetch from a URL. Creates FeedVersion and FeedFetch records. Returns an error if a serious failure occurs, such as database or filesystem access. Sets Result.FetchError if a regular failure occurs, such as a 404.

type StaticFetchValidator added in v1.0.0

type StaticFetchValidator struct {
	FeedVersion                *dmfr.FeedVersion
	FeedVersionValidatorResult *validator.Result
	StaticFetchOptions         StaticFetchOptions
}

func NewStaticFetchValidator added in v1.0.0

func NewStaticFetchValidator(opts StaticFetchOptions) *StaticFetchValidator

func (*StaticFetchValidator) Fetch added in v1.0.0

func (*StaticFetchValidator) ValidateResponse added in v1.0.0

func (sfv *StaticFetchValidator) ValidateResponse(ctx context.Context, atx tldb.Adapter, fn string, fetchResponse request.FetchResponse) (FetchValidationResult, error)

Jump to

Keyboard shortcuts

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