From f6aeed72c6c60e993cc4b27343d94c4ea08f45d8 Mon Sep 17 00:00:00 2001 From: Pantani Date: Fri, 17 May 2024 18:39:32 +0200 Subject: [PATCH] rename methods `CopyCache` to `CopyTo` and `SaveCache` to `Save` --- ignite/pkg/cosmosbuf/buf.go | 4 ++-- ignite/pkg/dircache/cache.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ignite/pkg/cosmosbuf/buf.go b/ignite/pkg/cosmosbuf/buf.go index 6970998a7d..a0470532ea 100644 --- a/ignite/pkg/cosmosbuf/buf.go +++ b/ignite/pkg/cosmosbuf/buf.go @@ -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 { @@ -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. diff --git a/ignite/pkg/dircache/cache.go b/ignite/pkg/dircache/cache.go index 3e279d9c40..14efc36504 100644 --- a/ignite/pkg/dircache/cache.go +++ b/ignite/pkg/dircache/cache.go @@ -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 @@ -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