persist

package
v0.6.60 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapshotVersion = 1

	ManifestsDir = "manifests"
)

Variables

This section is empty.

Functions

func ApplyIdentityRecords

func ApplyIdentityRecords(c cache.UserGroupCache, users, groups map[string]IdentityRecord)

func ApplyPollyRecords

func ApplyPollyRecords[T any](c *pollycache.Cache[T], records map[string]PollyRecord[T])

func ApplySHARecords

func ApplySHARecords(c *cache.SimpleCache[string], records map[string]SHARecord)

func IdentityRecordsFrom

func IdentityRecordsFrom(c cache.UserGroupCache) (users, groups map[string]IdentityRecord)

func PollyRecordsFrom

func PollyRecordsFrom[T any](c *pollycache.Cache[T]) map[string]PollyRecord[T]

func SHARecordsFrom

func SHARecordsFrom(c *cache.SimpleCache[string]) map[string]SHARecord

Types

type IdentityRecord

type IdentityRecord struct {
	Value   string    `json:"value"`
	Created time.Time `json:"created"`
}

type ManifestRecord

type ManifestRecord struct {
	Dir     string        `json:"dir"`
	SHA     string        `json:"sha"`
	Created time.Time     `json:"created"`
	Expiry  time.Duration `json:"expiry"`
}

type PollyRecord

type PollyRecord[T any] struct {
	Value   T         `json:"value"`
	Created time.Time `json:"created"`
}

type SHARecord

type SHARecord struct {
	Value     string    `json:"value"`
	ExpiresAt time.Time `json:"expiresAt"`
}

type Snapshot

type Snapshot struct {
	Version           int                                                      `json:"version"`
	Manifests         map[string]ManifestRecord                                `json:"manifests"`
	ComponentSHAs     map[string]SHARecord                                     `json:"componentShas"`
	StatusSHAs        map[string]SHARecord                                     `json:"statusShas"`
	UserIDs           map[string]IdentityRecord                                `json:"userIds"`
	GroupIDs          map[string]IdentityRecord                                `json:"groupIds"`
	ManagedNamespaces map[string]PollyRecord[console.ManagedNamespaceFragment] `json:"managedNamespaces"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(dir string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Dir

func (s *Store) Dir() string

func (*Store) Enabled

func (s *Store) Enabled() bool

func (*Store) Load

func (s *Store) Load() (Snapshot, error)

func (*Store) Save

func (s *Store) Save(snap Snapshot) error

func (*Store) StartPeriodic

func (s *Store) StartPeriodic(ctx context.Context, interval time.Duration, save func() error)

func (*Store) WaitPeriodic

func (s *Store) WaitPeriodic()

Jump to

Keyboard shortcuts

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