lockdown

package
v0.23.0-gosdk Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStats added in v0.22.0

type CacheStats struct {
	Hits      int64
	Misses    int64
	Evictions int64
}

CacheStats summarizes cache activity counters.

type RepoAccessCache added in v0.22.0

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

RepoAccessCache caches repository metadata related to lockdown checks so that multiple tools can reuse the same access information safely across goroutines.

func GetInstance added in v0.22.0

func GetInstance(client *githubv4.Client, opts ...RepoAccessOption) *RepoAccessCache

GetInstance returns the singleton instance of RepoAccessCache. It initializes the instance on first call with the provided client and options. Subsequent calls ignore the client and options parameters and return the existing instance. This is the preferred way to access the cache in production code.

func (*RepoAccessCache) IsSafeContent added in v0.22.0

func (c *RepoAccessCache) IsSafeContent(ctx context.Context, username, owner, repo string) (bool, error)

func (*RepoAccessCache) SetLogger added in v0.22.0

func (c *RepoAccessCache) SetLogger(logger *slog.Logger)

SetLogger updates the logger used for cache diagnostics.

type RepoAccessInfo added in v0.22.0

type RepoAccessInfo struct {
	IsPrivate     bool
	HasPushAccess bool
	ViewerLogin   string
}

RepoAccessInfo captures repository metadata needed for lockdown decisions.

type RepoAccessOption added in v0.22.0

type RepoAccessOption func(*RepoAccessCache)

RepoAccessOption configures RepoAccessCache at construction time.

func WithCacheName added in v0.22.0

func WithCacheName(name string) RepoAccessOption

WithCacheName overrides the cache table name used for storing entries. This option is intended for tests that need isolated cache instances.

func WithLogger added in v0.22.0

func WithLogger(logger *slog.Logger) RepoAccessOption

WithLogger sets the logger used for cache diagnostics.

func WithTTL added in v0.22.0

func WithTTL(ttl time.Duration) RepoAccessOption

WithTTL overrides the default TTL applied to cache entries. A non-positive duration disables expiration.

Jump to

Keyboard shortcuts

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