index

package
v0.0.0-...-d36d0e1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resource

type Resource struct {
	LastRefresh    time.Time  // Last time the index was downloaded
	IndexURL       url.URL    // The URL used to host the index.json
	IndexFile      paths.Path // The location of the index on the filesystem
	IndexSignature paths.Path // The location of the signature on the filesystem
}

Resource represent the index of the system

func Init

func Init(indexString string, directory *paths.Path) *Resource

Init will initialize the IndexResource structure and will return it. It will take indexString as a paramenter.

func (*Resource) DownloadAndVerify

func (ir *Resource) DownloadAndVerify() error

DownloadAndVerify will download an index file located at IndexURL and verify the signature if everything matches the files are overwritten

func (*Resource) Read

func (ir *Resource) Read() ([]byte, error)

Read will read the index file. In case it doesn't exists or the latest downloaded version is older than 1 hour, it will be downloaded again.

Jump to

Keyboard shortcuts

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