solver: small cleanup on function order
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>docker-18.09
parent
e58870889f
commit
238e15b29e
|
@ -74,13 +74,14 @@ type dep struct {
|
||||||
keyMap map[string]*CacheKey
|
keyMap map[string]*CacheKey
|
||||||
desiredState edgeStatusType
|
desiredState edgeStatusType
|
||||||
e *edge
|
e *edge
|
||||||
slowCacheReq pipe.Receiver // TODO: reuse req
|
slowCacheReq pipe.Receiver
|
||||||
slowCacheComplete bool
|
slowCacheComplete bool
|
||||||
slowCacheFoundKey bool
|
slowCacheFoundKey bool
|
||||||
slowCacheKey *ExportableCacheKey
|
slowCacheKey *ExportableCacheKey
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// expDep holds secorndary exporter info for dependency
|
||||||
type expDep struct {
|
type expDep struct {
|
||||||
index int
|
index int
|
||||||
cacheKey CacheKeyWithSelector
|
cacheKey CacheKeyWithSelector
|
||||||
|
@ -90,12 +91,14 @@ func newDep(i Index) *dep {
|
||||||
return &dep{index: i, keyMap: map[string]*CacheKey{}}
|
return &dep{index: i, keyMap: map[string]*CacheKey{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// edgePipe is a pipe for requests between two edges
|
||||||
type edgePipe struct {
|
type edgePipe struct {
|
||||||
*pipe.Pipe
|
*pipe.Pipe
|
||||||
From, Target *edge
|
From, Target *edge
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// edgeState hold basic mutable state info for an edge
|
||||||
type edgeState struct {
|
type edgeState struct {
|
||||||
state edgeStatusType
|
state edgeStatusType
|
||||||
result *SharedCachedResult
|
result *SharedCachedResult
|
||||||
|
@ -103,13 +106,6 @@ type edgeState struct {
|
||||||
keys []ExportableCacheKey
|
keys []ExportableCacheKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func isEqualState(s1, s2 edgeState) bool {
|
|
||||||
if s1.state != s2.state || s1.result != s2.result || s1.cacheMap != s2.cacheMap || len(s1.keys) != len(s2.keys) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
type edgeRequest struct {
|
type edgeRequest struct {
|
||||||
desiredState edgeStatusType
|
desiredState edgeStatusType
|
||||||
currentState edgeState
|
currentState edgeState
|
||||||
|
@ -342,14 +338,6 @@ func (e *edge) unpark(incoming []pipe.Sender, updates, allPipes []pipe.Receiver,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func withSelector(keys []ExportableCacheKey, selector digest.Digest) []CacheKeyWithSelector {
|
|
||||||
out := make([]CacheKeyWithSelector, len(keys))
|
|
||||||
for i, k := range keys {
|
|
||||||
out[i] = CacheKeyWithSelector{Selector: selector, CacheKey: k}
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *edge) makeExportable(k *CacheKey, records []*CacheRecord) ExportableCacheKey {
|
func (e *edge) makeExportable(k *CacheKey, records []*CacheRecord) ExportableCacheKey {
|
||||||
return ExportableCacheKey{
|
return ExportableCacheKey{
|
||||||
CacheKey: k,
|
CacheKey: k,
|
||||||
|
@ -857,3 +845,18 @@ func toResultSlice(cres []CachedResult) (out []Result) {
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isEqualState(s1, s2 edgeState) bool {
|
||||||
|
if s1.state != s2.state || s1.result != s2.result || s1.cacheMap != s2.cacheMap || len(s1.keys) != len(s2.keys) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func withSelector(keys []ExportableCacheKey, selector digest.Digest) []CacheKeyWithSelector {
|
||||||
|
out := make([]CacheKeyWithSelector, len(keys))
|
||||||
|
for i, k := range keys {
|
||||||
|
out[i] = CacheKeyWithSelector{Selector: selector, CacheKey: k}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue