staticasset

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveVersionDir

func DeriveVersionDir(dirOut string, source Source) string

func Fetch

func Fetch(source Source, options Options, trace TraceSink) error

func Lock

func Lock(source Source, dirVersion string, options Options, trace TraceSink) error

func SHA256Verifier

func SHA256Verifier(expected string) func(string) error

func Sync

func Sync(source Source, options Options, trace TraceSink) error

Types

type Asset

type Asset struct {
	Name                  string
	Path                  string
	URL                   string
	RecoverDownloadError  func(string, error) (bool, error)                     `toml:"-"`
	VerifyDownloadedFile  func(string) error                                    `toml:"-"`
	HashForLock           func(string, HashProgressFunc) (string, int64, error) `toml:"-"`
	ReuseVerifiedExisting bool                                                  `toml:"-"`
	ExpectedBytes         int64                                                 `toml:"-"`
}

type FileRecord

type FileRecord struct {
	Asset  string
	Path   string
	SHA256 string
	Bytes  int64
	URL    string
}

type HashProgressFunc

type HashProgressFunc = httpx.DownloadProgressFunc

type Manifest

type Manifest struct {
	Database     string               `toml:"database"`
	Asset        string               `toml:"asset"`
	Source       string               `toml:"source,omitempty"`
	Version      string               `toml:"version"`
	VersionToken string               `toml:"version_token"`
	DownloadedAt string               `toml:"downloaded_at"`
	Scope        Scope                `toml:"scope,omitempty"`
	Files        []ManifestFileRecord `toml:"files"`
}

func ReadManifest

func ReadManifest(fileManifest string) (Manifest, bool, error)

type ManifestFileRecord

type ManifestFileRecord struct {
	Asset  string `toml:"asset"`
	Path   string `toml:"path"`
	SHA256 string `toml:"sha256"`
	Bytes  int64  `toml:"bytes"`
	URL    string `toml:"url"`
}

type Options

type Options struct {
	DirOut                 string
	RuleExisting           string
	RetryMax               int
	RetryWait              time.Duration
	WorkersMax             int
	RequestInterval        time.Duration
	ShouldAllowInsecureTLS bool
	ShouldDryRun           bool
	ShouldDisableProgress  bool
	ProgressWriter         io.Writer
}

type Scope

type Scope struct {
	Type  string `toml:"type,omitempty"`
	Value string `toml:"value,omitempty"`
}

type Source

type Source struct {
	Database               string
	Asset                  string
	Source                 string
	DirName                string
	Version                string
	VersionToken           string
	Scope                  Scope
	Assets                 []Asset
	LockOnlyDeclaredAssets bool
	RequiredAssets         []string
	RequireCompleteAssets  bool
	RejectUndeclaredAssets bool
}

type TraceEvent

type TraceEvent struct {
	Event        string
	Database     string
	Asset        string
	VersionToken string
	Path         string
	URL          string
	Bytes        int64
	SHA256       string
	Status       string
}

type TraceSink

type TraceSink interface {
	EmitStaticAssetTrace(event TraceEvent)
}

Jump to

Keyboard shortcuts

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