@@ -32,14 +32,14 @@ const (
32
32
expirationInterval = 10 * time .Hour
33
33
)
34
34
35
- // CacheEntry is an entry of the drain cache. It stores at which time a Machine was drained the last time.
35
+ // CacheEntry is an entry of the requeue cache. It stores at which time a Machine was proceeded the last time.
36
36
type CacheEntry struct {
37
- Machine types.NamespacedName
38
- LastDrain time.Time
37
+ Machine types.NamespacedName
38
+ LastProceed time.Time
39
39
}
40
40
41
- // Cache caches the time when the last drain was done for a Machine .
42
- // Specifically we only use it to ensure we only retry drains
41
+ // Cache caches the time when the a Machine was processed last .
42
+ // Specifically we use it to ensure we only drain or wait for volume detachment
43
43
// at a specific interval and not more often.
44
44
type Cache interface {
45
45
// Add adds the given entry to the Cache.
@@ -53,7 +53,7 @@ type Cache interface {
53
53
54
54
// NewCache creates a new cache.
55
55
func NewCache () Cache {
56
- r := & drainCache {
56
+ r := & retryCache {
57
57
Store : cache .NewTTLStore (func (obj interface {}) (string , error ) {
58
58
// We only add CacheEntries to the cache, so it's safe to cast to CacheEntry.
59
59
return obj .(CacheEntry ).Machine .String (), nil
@@ -72,13 +72,13 @@ func NewCache() Cache {
72
72
return r
73
73
}
74
74
75
- type drainCache struct {
75
+ type retryCache struct {
76
76
cache.Store
77
77
}
78
78
79
79
// Add adds the given entry to the Cache.
80
80
// Note: entries expire after the ttl.
81
- func (r * drainCache ) Add (entry CacheEntry ) {
81
+ func (r * retryCache ) Add (entry CacheEntry ) {
82
82
// Note: We can ignore the error here because by only allowing CacheEntries
83
83
// and providing the corresponding keyFunc ourselves we can guarantee that
84
84
// the error never occurs.
@@ -87,7 +87,7 @@ func (r *drainCache) Add(entry CacheEntry) {
87
87
88
88
// Has checks if the given key (still) exists in the Cache.
89
89
// Note: entries expire after the ttl.
90
- func (r * drainCache ) Has (machineName types.NamespacedName ) (CacheEntry , bool ) {
90
+ func (r * retryCache ) Has (machineName types.NamespacedName ) (CacheEntry , bool ) {
91
91
// Note: We can ignore the error here because GetByKey never returns an error.
92
92
item , exists , _ := r .Store .GetByKey (machineName .String ())
93
93
if exists {
0 commit comments