cache

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaemonInfoExists added in v2.12.0

func DaemonInfoExists(ctx context.Context, file string) (bool, error)

func DaemonInfoFile added in v2.12.0

func DaemonInfoFile(name string, port int) string

func DaemonPortForName added in v2.12.0

func DaemonPortForName(ctx context.Context, context string) (int, error)

func DeleteDaemonInfo added in v2.12.0

func DeleteDaemonInfo(ctx context.Context, file string) error

func DeleteFromUserCache

func DeleteFromUserCache(ctx context.Context, file string) error

func DeleteIngressesFromUserCache

func DeleteIngressesFromUserCache(ctx context.Context) error

DeleteIngressesFromUserCache removes the ingresses cache if exists or returns an error. An attempt to remove a non-existing cache is a no-op and the function returns nil.

func ExistsInCache added in v2.11.0

func ExistsInCache(ctx context.Context, fileName string) (bool, error)

func KeepDaemonInfoAlive added in v2.12.0

func KeepDaemonInfoAlive(ctx context.Context, file string) error

KeepDaemonInfoAlive updates the access and modification times of the given DaemonInfo periodically so that it never gets older than keepAliveInterval. This means that any file with a modification time older than the current time minus two keepAliveIntervals can be considered stale and should be removed.

The alive poll ends and the DaemonInfo is deleted when the context is cancelled.

func LoadFromUserCache

func LoadFromUserCache(ctx context.Context, dest any, file string) error

func LoadIngressesFromUserCache

func LoadIngressesFromUserCache(ctx context.Context) (map[string]*manager.IngressInfo, error)

LoadIngressesFromUserCache gets the ingresses from cache. An empty map is returned if the file does not exist. An error is returned if something goes wrong while loading or unmarshalling.

func SaveDaemonInfo added in v2.12.0

func SaveDaemonInfo(ctx context.Context, object *DaemonInfo, file string) error

func SaveIngressesToUserCache

func SaveIngressesToUserCache(ctx context.Context, ingresses map[string]*manager.IngressInfo) error

SaveIngressesToUserCache saves the provided ingresses to user cache and returns an error if something goes wrong while marshalling or persisting.

func SaveToUserCache

func SaveToUserCache(ctx context.Context, object any, file string) error

func WatchDaemonInfos added in v2.12.0

func WatchDaemonInfos(ctx context.Context, onChange func(context.Context) error, files ...string) error

func WatchUserCache added in v2.12.0

func WatchUserCache(ctx context.Context, subdir string, onChange func(context.Context) error, files ...string) error

WatchUserCache uses a file system watcher that receives events when the file changes and calls the given function when that happens.

Types

type DaemonInfo added in v2.12.0

type DaemonInfo struct {
	Options     map[string]string `json:"options,omitempty"`
	InDocker    bool              `json:"in_docker,omitempty"`
	KubeContext string            `json:"kube_context,omitempty"`
	DaemonPort  int               `json:"daemon_port,omitempty"`
}

func LoadDaemonInfo added in v2.12.0

func LoadDaemonInfo(ctx context.Context, file string) (*DaemonInfo, error)

func LoadDaemonInfos added in v2.12.0

func LoadDaemonInfos(ctx context.Context) ([]*DaemonInfo, error)

Jump to

Keyboard shortcuts

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