forked from TrueCloudLab/restic
Make Cache.Path private
It's only used inside the package.
This commit is contained in:
parent
23fcbb275a
commit
cb3f531050
2 changed files with 4 additions and 4 deletions
4
internal/cache/cache.go
vendored
4
internal/cache/cache.go
vendored
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
// Cache manages a local cache.
|
// Cache manages a local cache.
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
Path string
|
path string
|
||||||
Base string
|
Base string
|
||||||
Created bool
|
Created bool
|
||||||
PerformReadahead func(restic.Handle) bool
|
PerformReadahead func(restic.Handle) bool
|
||||||
|
@ -148,7 +148,7 @@ func New(id string, basedir string) (c *Cache, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c = &Cache{
|
c = &Cache{
|
||||||
Path: cachedir,
|
path: cachedir,
|
||||||
Base: basedir,
|
Base: basedir,
|
||||||
Created: created,
|
Created: created,
|
||||||
PerformReadahead: func(restic.Handle) bool {
|
PerformReadahead: func(restic.Handle) bool {
|
||||||
|
|
4
internal/cache/file.go
vendored
4
internal/cache/file.go
vendored
|
@ -17,7 +17,7 @@ func (c *Cache) filename(h restic.Handle) string {
|
||||||
panic("Name is empty or too short")
|
panic("Name is empty or too short")
|
||||||
}
|
}
|
||||||
subdir := h.Name[:2]
|
subdir := h.Name[:2]
|
||||||
return filepath.Join(c.Path, cacheLayoutPaths[h.Type], subdir, h.Name)
|
return filepath.Join(c.path, cacheLayoutPaths[h.Type], subdir, h.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) canBeCached(t restic.FileType) bool {
|
func (c *Cache) canBeCached(t restic.FileType) bool {
|
||||||
|
@ -185,7 +185,7 @@ func (c *Cache) list(t restic.FileType) (restic.IDSet, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
list := restic.NewIDSet()
|
list := restic.NewIDSet()
|
||||||
dir := filepath.Join(c.Path, cacheLayoutPaths[t])
|
dir := filepath.Join(c.path, cacheLayoutPaths[t])
|
||||||
err := filepath.Walk(dir, func(name string, fi os.FileInfo, err error) error {
|
err := filepath.Walk(dir, func(name string, fi os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Walk")
|
return errors.Wrap(err, "Walk")
|
||||||
|
|
Loading…
Reference in a new issue