Documentation ¶
Index ¶
- func EvictOnConnectionFailure(dialer proxy.Dialer, frequency time.Duration) func(*RemoteSnapshotterCache)
- type EvictOnConnectionFailurePolicy
- type EvictionPolicy
- type RemoteSnapshotterCache
- func (c *RemoteSnapshotterCache) Close() error
- func (c *RemoteSnapshotterCache) Evict(key string) error
- func (c *RemoteSnapshotterCache) Get(ctx context.Context, key string) (*proxy.RemoteSnapshotter, error)
- func (c *RemoteSnapshotterCache) List() []string
- func (c *RemoteSnapshotterCache) WalkAll(ctx context.Context, fn snapshots.WalkFunc, filters ...string) error
- type SnapshotterCacheOption
- type SnapshotterProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvictOnConnectionFailure ¶
func EvictOnConnectionFailure(dialer proxy.Dialer, frequency time.Duration) func(*RemoteSnapshotterCache)
EvictOnConnectionFailure is a caching option for evicting entries from the cache after a failed connection attempt.
Types ¶
type EvictOnConnectionFailurePolicy ¶
type EvictOnConnectionFailurePolicy struct {
// contains filtered or unexported fields
}
EvictOnConnectionFailurePolicy defines an eviction policy where entries are evicted from cache after a failed connection attempt occurs.
func (EvictOnConnectionFailurePolicy) Enforce ¶
func (p EvictOnConnectionFailurePolicy) Enforce(key string)
Enforce launches a go routine which periodically attempts to dial the cached entry using the provided dial function.
On connection failure, the entry will be evicted from cache.
type EvictionPolicy ¶
type EvictionPolicy interface { // Enforce monitors for policy failures. Enforce(key string) }
EvictionPolicy defines the interface for enforcing a cache eviction policy.
func NewEvictOnConnectionFailurePolicy ¶
func NewEvictOnConnectionFailurePolicy(evictChan chan string, dialer proxy.Dialer, frequency time.Duration, stopCondition chan struct{}) EvictionPolicy
NewEvictOnConnectionFailurePolicy creates a new policy to evict on remote snapshotter connection failure on a specified frequency duration.
type RemoteSnapshotterCache ¶
type RemoteSnapshotterCache struct {
// contains filtered or unexported fields
}
RemoteSnapshotterCache implements a cache for remote snapshotters.
func NewRemoteSnapshotterCache ¶
func NewRemoteSnapshotterCache(fetch SnapshotterProvider, opts ...SnapshotterCacheOption) *RemoteSnapshotterCache
NewRemoteSnapshotterCache creates a new instance with an empty cache and applies any provided caching options.
func (*RemoteSnapshotterCache) Close ¶
func (c *RemoteSnapshotterCache) Close() error
Close terminates any background reapers and closes any cached snapshotters.
func (*RemoteSnapshotterCache) Evict ¶
func (c *RemoteSnapshotterCache) Evict(key string) error
Evict removes a cached snapshotter for a given key.
func (*RemoteSnapshotterCache) Get ¶
func (c *RemoteSnapshotterCache) Get(ctx context.Context, key string) (*proxy.RemoteSnapshotter, error)
Get fetches and caches the snapshotter for a given key.
func (*RemoteSnapshotterCache) List ¶
func (c *RemoteSnapshotterCache) List() []string
List returns the keys of a snapshotter cache.
type SnapshotterCacheOption ¶
type SnapshotterCacheOption func(*RemoteSnapshotterCache)
SnapshotterCacheOption is a functional option that operates on a remote snapshotter cache.
type SnapshotterProvider ¶
SnapshotterProvider defines a snapshotter fetch function.