data

package
v0.0.0-...-5f25c38 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCacheID

func NewCacheID() string

Types

type ApplicationData

type ApplicationData struct {
	RateLimit    RateLimit                        `json:"rate_limit"`
	Repositories map[string]*RepositoryCacheEntry `json:"repositories"`
}

func (*ApplicationData) GetRepositoryEntryByKey

func (ad *ApplicationData) GetRepositoryEntryByKey(key string, owner *Cache) *RepositoryCacheEntry

func (*ApplicationData) HasRepositoryEntryByKey

func (ad *ApplicationData) HasRepositoryEntryByKey(key string) bool

func (*ApplicationData) SetRepositoryEntryByKey

func (ad *ApplicationData) SetRepositoryEntryByKey(key string, entry *RepositoryCacheEntry, owner *Cache)

type Cache

type Cache struct {
	Filename string
	Data     ApplicationData
	Debug    bool
	// contains filtered or unexported fields
}

func NewCache

func NewCache(filename string) *Cache

func (*Cache) AddRepository

func (c *Cache) AddRepository(name, target string, filters []string, findResult *finders.FindResult, expiresAt time.Time) (*RepositoryCacheEntry, bool)

func (*Cache) Get

func (c *Cache) Get(key string) (*RepositoryCacheEntry, bool)

Get retrieves an entry from the cache.

func (*Cache) Has

func (c *Cache) Has(name string) bool

func (*Cache) LoadFromFile

func (c *Cache) LoadFromFile() error

func (*Cache) PurgeExpired

func (c *Cache) PurgeExpired()

func (*Cache) SaveToFile

func (c *Cache) SaveToFile() error

SaveToFile saves the entire cache to a JSON file.

func (*Cache) Set

Set adds a new entry to the cache with a TTL.

func (*Cache) SetRateLimit

func (c *Cache) SetRateLimit(limit int, remaining int, reset time.Time)

type RateLimit

type RateLimit struct {
	Service   string     `json:"service"`
	Limit     int        `json:"limit"`
	Remaining int        `json:"remaining"`
	Reset     *time.Time `json:"reset"`
}

type RepositoryCacheEntry

type RepositoryCacheEntry struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	LastCheckAt     time.Time      `json:"last_check_at"`
	LastDownloadAt  time.Time      `json:"last_download_at"`
	LastDownloadTag string         `json:"last_download_tag"`
	LastReleaseDate time.Time      `json:"last_release_date"`
	ExpiresAt       time.Time      `json:"expires_at"`
	Target          string         `json:"target"`
	Filters         []string       `json:"filters"`
	Assets          []assets.Asset `json:"assets"`
	FindError       error          `json:"find_error"`
	// contains filtered or unexported fields
}

func (*RepositoryCacheEntry) Exists

func (rce *RepositoryCacheEntry) Exists() bool

func (*RepositoryCacheEntry) GetOwner

func (rce *RepositoryCacheEntry) GetOwner() *Cache

func (*RepositoryCacheEntry) UpdateCheckedAt

func (rce *RepositoryCacheEntry) UpdateCheckedAt()

func (*RepositoryCacheEntry) UpdateDownloadedAt

func (rce *RepositoryCacheEntry) UpdateDownloadedAt(tag string)

Jump to

Keyboard shortcuts

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