package actionscache
import "github.com/tonistiigi/go-actions-cache"
Index ¶
- Constants
- Variables
- type BackoffPool
- func (b *BackoffPool) Delay()
- func (b *BackoffPool) Reset()
- func (b *BackoffPool) Wait(ctx context.Context, timeout time.Duration) error
- type Blob
- type Cache
- func New(token, url string, v2 bool, opt Opt) (*Cache, error)
- func TryEnv(opt Opt) (*Cache, error)
- func (c *Cache) AllKeys(ctx context.Context, api *RestAPI, prefix string) (map[string]struct{}, error)
- func (c *Cache) Load(ctx context.Context, keys ...string) (*Entry, error)
- func (c *Cache) Save(ctx context.Context, key string, b Blob) error
- func (c *Cache) SaveMutable(ctx context.Context, key string, forceTimeout time.Duration, f func(old *Entry) (Blob, error)) error
- func (c *Cache) Scopes() []Scope
- type CacheKey
- type CommitCacheReq
- type Entry
- func (ce *Entry) Download(ctx context.Context) ReaderAtCloser
- func (ce *Entry) WriteTo(ctx context.Context, w io.Writer) error
- type GithubAPIError
- type HTTPError
- type Opt
- type Permission
- type ReaderAtCloser
- type ReserveCacheReq
- type ReserveCacheResp
- type RestAPI
- func NewRestAPI(repo, token string, opt Opt) (*RestAPI, error)
- func (r *RestAPI) ListKeys(ctx context.Context, prefix, ref string) ([]CacheKey, error)
- type Scope
Constants ¶
const ( PermissionRead = 1 << iota PermissionWrite )
Variables ¶
var Log = func(string, ...interface{}) {}
var UploadChunkSize = 32 * 1024 * 1024
var UploadConcurrency = 4
Types ¶
type BackoffPool ¶
type BackoffPool struct {
// contains filtered or unexported fields
}
func (*BackoffPool) Delay ¶
func (b *BackoffPool) Delay()
func (*BackoffPool) Reset ¶
func (b *BackoffPool) Reset()
func (*BackoffPool) Wait ¶
type Blob ¶
func NewBlob ¶
type Cache ¶
type Cache struct { URL string Token *jwt.Token IssuedAt time.Time ExpiresAt time.Time IsV2 bool // contains filtered or unexported fields }
func New ¶
func TryEnv ¶
func (*Cache) AllKeys ¶
func (c *Cache) AllKeys(ctx context.Context, api *RestAPI, prefix string) (map[string]struct{}, error)
func (*Cache) Load ¶
func (*Cache) Save ¶
func (*Cache) SaveMutable ¶
func (c *Cache) SaveMutable(ctx context.Context, key string, forceTimeout time.Duration, f func(old *Entry) (Blob, error)) error
SaveMutable stores a blob over a possibly existing key. Previous value is passed to callback that needs to return new blob. Callback may be called multiple times if two saves happen during same time window. In case of a crash a key may remain locked, preventing previous changes. Timeout can be set to force changes in this case without guaranteeing that previous value was up to date.
func (*Cache) Scopes ¶
type CacheKey ¶
type CacheKey struct { ID int `json:"id"` Ref string `json:"ref"` Key string `json:"key"` Version string `json:"version"` LastAccessed string `json:"last_accessed_at"` CreatedAt string `json:"created_at"` SizeInBytes int `json:"size_in_bytes"` }
type CommitCacheReq ¶
type CommitCacheReq struct { Size int64 `json:"size"` }
type Entry ¶
type Entry struct { Key string `json:"cacheKey"` Scope string `json:"scope"` URL string `json:"archiveLocation"` IsAzureBlob bool `json:"isAzureBlob"` // contains filtered or unexported fields }
func (*Entry) Download ¶
func (ce *Entry) Download(ctx context.Context) ReaderAtCloser
Download returns a ReaderAtCloser for pulling the data. Concurrent reads are not allowed
func (*Entry) WriteTo ¶
type GithubAPIError ¶
type GithubAPIError struct { Message string `json:"message"` TypeName string `json:"typeName"` TypeKey string `json:"typeKey"` ErrorCode int `json:"errorCode"` }
func (GithubAPIError) Error ¶
func (e GithubAPIError) Error() string
func (GithubAPIError) Is ¶
func (e GithubAPIError) Is(err error) bool
type HTTPError ¶
func (HTTPError) Error ¶
func (HTTPError) Unwrap ¶
type Opt ¶
type Opt struct { Client *http.Client Timeout time.Duration BackoffPool *BackoffPool UserAgent string }
type Permission ¶
type Permission int
func (Permission) String ¶
func (p Permission) String() string
type ReaderAtCloser ¶
type ReserveCacheReq ¶
type ReserveCacheResp ¶
type ReserveCacheResp struct { CacheID int `json:"cacheID"` }
type RestAPI ¶
type RestAPI struct {
// contains filtered or unexported fields
}
func NewRestAPI ¶
func (*RestAPI) ListKeys ¶
type Scope ¶
type Scope struct { Scope string Permission Permission }
Source Files ¶
cache.go cache_v2.go readerat.go rest.go retry.go
- Version
- v0.0.0-20250228231703-3e9a6642607f (latest)
- Published
- Feb 28, 2025
- Platform
- darwin/amd64
- Imports
- 23 packages
- Last checked
- 1 month ago –
Tools for package owners.