Skip to content

Commit

Permalink
Clarify CacheValidity option and add NoCache/MaxCache consts
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Soyland <codysoyland@github.com>
  • Loading branch information
codysoyland committed Feb 9, 2024
1 parent 1d0f156 commit 37bb81f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/tuf/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package tuf

import (
"embed"
"math"
"os"
"path/filepath"

Expand All @@ -25,11 +26,20 @@ import (
//go:embed repository
var embeddedRepo embed.FS

const DefaultMirror = "https://tuf-repo-cdn.sigstore.dev"
const (
DefaultMirror = "https://tuf-repo-cdn.sigstore.dev"

// The following caching values can be used for the CacheValidity option
NoCache = 0
MaxCache = math.MaxInt
)

// Options represent the various options for a Sigstore TUF Client
type Options struct {
// CacheValidity period in days (default 0)
// CacheValidity period in days (default 0). Note that the client will
// always refresh the cache if the metadata is expired, so this is not an
// optimal control for air-gapped environments. Use const MaxCache to only
// update the cache when the metadata is expired.
CacheValidity int
// ForceCache controls if the cache should be used without update
// as long as the metadata is valid
Expand Down

0 comments on commit 37bb81f

Please sign in to comment.