fs

package
v0.0.0-...-f9ad26b Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FilenameFormatString = "%d-check.json"

FilenameFormatString is the format string used by GenerateFilename to create a filename.

View Source
const IndexName = "index.json"
View Source
const Type = "fs"

Type should match the package name

Variables

This section is empty.

Functions

func GenerateFilename

func GenerateFilename() *string

GenerateFilename returns a filename that is ideal for storing the results file on a storage provider that relies on the filename for retrieval that is sorted by date/timeframe. It returns a string pointer to be used by the AWS SDK...

Types

type Storage

type Storage struct {
	// The path to the directory where check files will be stored.
	Dir string `json:"dir"`
	// The URL corresponding to fs.Dir.
	URL string `json:"url"`

	// Check files older than CheckExpiry will be
	// deleted on calls to Maintain(). If this is
	// the zero value, no old check files will be
	// deleted.
	CheckExpiry time.Duration `json:"check_expiry,omitempty"`
}

Storage is a way to store checkup results on the local filesystem.

func New

func New(config json.RawMessage) (Storage, error)

New creates a new Storage instance based on json config

func (Storage) Fetch

func (fs Storage) Fetch(name string) ([]types.Result, error)

Fetch fetches results from filesystem for the specified index.

func (Storage) GetIndex

func (fs Storage) GetIndex() (map[string]int64, error)

GetIndex returns the index from filesystem.

func (Storage) Maintain

func (fs Storage) Maintain() error

Maintain deletes check files that are older than fs.CheckExpiry.

func (Storage) Store

func (fs Storage) Store(results []types.Result) error

Store stores results on filesystem according to the configuration in fs.

func (Storage) Type

func (Storage) Type() string

Type returns the storage driver package name

Jump to

Keyboard shortcuts

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