Skip to content

Commit

Permalink
consistent rename to ItemState
Browse files Browse the repository at this point in the history
  • Loading branch information
sppatel committed Sep 22, 2022
1 parent 570f097 commit c3a6c67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cli/internal/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ func (mplex *cacheMultiplexer) Fetch(target string, key string, files []string)
func (mplex *cacheMultiplexer) Exists(target string) (ItemStatus, error) {
syncCacheState := ItemStatus{}
for _, cache := range mplex.caches {
cacheState, err := cache.Exists(target)
itemStatus, err := cache.Exists(target)
if err != nil {
return syncCacheState, err
}
syncCacheState.Local = syncCacheState.Local || cacheState.Local
syncCacheState.Remote = syncCacheState.Remote || cacheState.Remote
syncCacheState.Local = syncCacheState.Local || itemStatus.Local
syncCacheState.Remote = syncCacheState.Remote || itemStatus.Remote
}

return syncCacheState, nil
Expand Down
8 changes: 4 additions & 4 deletions cli/internal/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ func TestExists(t *testing.T) {
caches: caches,
}

cacheState, err := mplex.Exists("some-hash")
itemStatus, err := mplex.Exists("some-hash")
if err != nil {
t.Errorf("got error verifying files: %v", err)
}
if cacheState.Local {
if itemStatus.Local {
t.Error("did not expect file to exist")
}

Expand All @@ -142,11 +142,11 @@ func TestExists(t *testing.T) {
t.Errorf("Put got error %v, want <nil>", err)
}

cacheState, err = mplex.Exists("some-hash")
itemStatus, err = mplex.Exists("some-hash")
if err != nil {
t.Errorf("got error verifying files: %v", err)
}
if !cacheState.Local {
if !itemStatus.Local {
t.Error("failed to find previously stored files")
}
}
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ func (r *run) executeDryRun(ctx gocontext.Context, engine *core.Scheduler, g *co
}
sort.Strings(stringDescendents)

cacheState, err := turboCache.Exists(hash)
itemStatus, err := turboCache.Exists(hash)
if err != nil {
return err
}
Expand All @@ -784,7 +784,7 @@ func (r *run) executeDryRun(ctx gocontext.Context, engine *core.Scheduler, g *co
Task: packageTask.Task,
Package: packageTask.PackageName,
Hash: hash,
CacheState: cacheState,
CacheState: itemStatus,
Command: command,
Dir: packageTask.Pkg.Dir.ToString(),
Outputs: packageTask.TaskDefinition.Outputs,
Expand Down

0 comments on commit c3a6c67

Please # to comment.