cachetypes

package
v1.6.4-pre.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cachetypes contains type definitions for caches in Porch.

Index

Constants

View Source
const DefaultDBCacheDriver string = "pgx"

Variables

This section is empty.

Functions

func IsACacheType

func IsACacheType(ct string) bool

Types

type CRCacheOptions

type CRCacheOptions struct {
	MaxConcurrentLists       int
	ListTimeoutPerRepository time.Duration
}

type Cache

type Cache interface {
	// Full lifecycle (used by porch-controller)
	OpenRepository(ctx context.Context, repositorySpec *configapi.Repository) (repository.Repository, error)
	CloseRepository(ctx context.Context, repositorySpec *configapi.Repository, allRepos []configapi.Repository) error
	GetRepositories() []*configapi.Repository
	GetRepository(repository.RepositoryKey) repository.Repository
	UpdateRepository(ctx context.Context, repositorySpec *configapi.Repository) error
	CheckRepositoryConnectivity(ctx context.Context, repositorySpec *configapi.Repository) error
	FindAllUpstreamReferencesInRepositories(ctx context.Context, namespace, prName string) (string, error)
	ListPackageRevisions(ctx context.Context, filter repository.ListPackageRevisionFilter) ([]repository.PackageRevision, error)

	// Memory-only operations (used by porch-server's cache handler)
	// These never touch the database — only the in-memory map and git clone.
	EvictCachedRepository(ctx context.Context, namespace, name string) error
}
var (
	CacheInstance Cache
)

type CacheFactory

type CacheFactory interface {
	NewCache(ctx context.Context, options CacheOptions) (Cache, error)
}

type CacheOptions

type CacheOptions struct {
	ExternalRepoOptions        externalrepotypes.ExternalRepoOptions
	RepoOperationRetryAttempts int
	RepoPRChangeNotifier       RepoPRChangeNotifier
	CoreClient                 client.WithWatch
	CacheType                  CacheType
	DBCacheOptions             DBCacheOptions
	CRCacheOptions             CRCacheOptions
	DbPushDraftsToGit          bool
	RepoSyncFrequency          time.Duration
}

type CacheType

type CacheType string
const (
	CRCacheType      CacheType = "CR"
	DBCacheType      CacheType = "DB"
	DefaultCacheType CacheType = CRCacheType
)

type DBCacheOptions

type DBCacheOptions struct {
	Driver             string
	DataSource         string
	MaxConnections     int
	MaxIdleConnections int
	MaxConnLifetime    time.Duration
}

type RepoPRChangeNotifier

type RepoPRChangeNotifier interface {
	NotifyPackageRevisionChange(eventType watch.EventType, obj repository.PackageRevision) int
}

func NewNoOpRepoPRChangeNotifier added in v1.6.0

func NewNoOpRepoPRChangeNotifier() RepoPRChangeNotifier

NewNoOpRepoPRChangeNotifier creates a no-op notifier

Jump to

Keyboard shortcuts

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