diffcache

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapshotNameCreation = "creation"
	SnapshotNameDeletion = "deletion"
)

Variables

View Source
var VerbToSnapshotName = map[string]string{
	"create": SnapshotNameCreation,
	"delete": SnapshotNameDeletion,
}

Functions

This section is empty.

Types

type Cache

type Cache interface {
	GetCommonOptions() *CommonOptions

	Store(ctx context.Context, object utilobject.Key, patch *Patch)
	Fetch(ctx context.Context, object utilobject.Key, oldResourceVersion string, newResourceVersion *string) (*Patch, error)

	StoreSnapshot(ctx context.Context, object utilobject.Key, snapshotName string, snapshot *Snapshot)
	FetchSnapshot(ctx context.Context, object utilobject.Key, snapshotName string) (*Snapshot, error)

	List(ctx context.Context, object utilobject.Key, limit int) ([]string, error)
}

type CacheWrapper

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

func (*CacheWrapper) Fetch

func (wrapper *CacheWrapper) Fetch(
	ctx context.Context,
	object utilobject.Key,
	oldResourceVersion string,
	newResourceVersion *string,
) (*Patch, error)

func (*CacheWrapper) FetchSnapshot

func (wrapper *CacheWrapper) FetchSnapshot(
	ctx context.Context,
	object utilobject.Key,
	snapshotName string,
) (*Snapshot, error)

func (*CacheWrapper) GetCommonOptions

func (wrapper *CacheWrapper) GetCommonOptions() *CommonOptions

func (*CacheWrapper) List

func (wrapper *CacheWrapper) List(ctx context.Context, object utilobject.Key, limit int) ([]string, error)

List always penetrates the cache because we cannot get notified of new keys

func (*CacheWrapper) Store

func (wrapper *CacheWrapper) Store(ctx context.Context, object utilobject.Key, patch *Patch)

func (*CacheWrapper) StoreSnapshot

func (wrapper *CacheWrapper) StoreSnapshot(
	ctx context.Context,
	object utilobject.Key,
	snapshotName string,
	snapshot *Snapshot,
)

type CommonOptions

type CommonOptions struct {
	PatchTtl           time.Duration
	SnapshotTtl        time.Duration
	EnableCacheWrapper bool
}

func (*CommonOptions) Setup

func (options *CommonOptions) Setup(fs *pflag.FlagSet)

type Patch

type Patch struct {
	InformerTime       time.Time
	OldResourceVersion string
	NewResourceVersion string
	Redacted           bool `json:"Redacted,omitempty"`
	DiffList           diffcmp.DiffList
}

type Snapshot

type Snapshot struct {
	ResourceVersion string
	Redacted        bool `json:"Redacted,omitempty"`
	Value           json.RawMessage
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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