Skip to content

Commit

Permalink
rename methods CopyCache to CopyTo and SaveCache to Save
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani authored and Pantani committed May 17, 2024
1 parent c72bbcb commit f6aeed7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ignite/pkg/cosmosbuf/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (b Buf) Generate(
}

// check if already exist a cache for the template.
key, err := b.cache.CopyCache(protoPath, output, template)
key, err := b.cache.CopyTo(protoPath, output, template)
if err != nil && !errors.Is(err, dircache.ErrCacheNotFound) {
return err
} else if err == nil {
Expand Down Expand Up @@ -229,7 +229,7 @@ func (b Buf) Generate(
}
}

return b.cache.SaveCache(output, key)
return b.cache.Save(output, key)
}

// runCommand run the buf CLI command.
Expand Down
8 changes: 4 additions & 4 deletions ignite/pkg/dircache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func cacheKey(src string, keys ...string) (string, error) {
return fmt.Sprintf("%x", h.Sum(nil)), nil
}

// CopyCache gets the cache folder based on the cache key from the storage and copies the folder to the output.
func (c Cache) CopyCache(src, output string, keys ...string) (string, error) {
// CopyTo gets the cache folder based on the cache key from the storage and copies the folder to the output.
func (c Cache) CopyTo(src, output string, keys ...string) (string, error) {
key, err := cacheKey(src, keys...)
if err != nil {
return key, err
Expand All @@ -95,8 +95,8 @@ func (c Cache) CopyCache(src, output string, keys ...string) (string, error) {
return key, nil
}

// SaveCache copies the source to the cache folder and saves the path into the storage based on the key.
func (c Cache) SaveCache(src, key string) error {
// Save copies the source to the cache folder and saves the path into the storage based on the key.
func (c Cache) Save(src, key string) error {
path := filepath.Join(c.path, key)
if err := os.Mkdir(path, 0o700); os.IsExist(err) {
return nil
Expand Down

0 comments on commit f6aeed7

Please sign in to comment.