1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

cache: unexport internal functions

This commit is contained in:
Alexander Neumann 2015-05-02 15:49:14 +02:00
parent 819b6da762
commit 0a65901e18

View file

@ -99,7 +99,7 @@ func (c *Cache) purge(t backend.Type, subtype string, id backend.ID) error {
} }
func (c *Cache) Clear(s *server.Server) error { func (c *Cache) Clear(s *server.Server) error {
list, err := c.List(backend.Snapshot) list, err := c.list(backend.Snapshot)
if err != nil { if err != nil {
return err return err
} }
@ -120,19 +120,19 @@ func (c *Cache) Clear(s *server.Server) error {
return nil return nil
} }
type CacheEntry struct { type cacheEntry struct {
ID backend.ID ID backend.ID
Subtype string Subtype string
} }
func (c CacheEntry) String() string { func (c cacheEntry) String() string {
if c.Subtype != "" { if c.Subtype != "" {
return c.ID.Str() + "." + c.Subtype return c.ID.Str() + "." + c.Subtype
} }
return c.ID.Str() return c.ID.Str()
} }
func (c *Cache) List(t backend.Type) ([]CacheEntry, error) { func (c *Cache) list(t backend.Type) ([]cacheEntry, error) {
var dir string var dir string
switch t { switch t {
@ -145,7 +145,7 @@ func (c *Cache) List(t backend.Type) ([]CacheEntry, error) {
fd, err := os.Open(dir) fd, err := os.Open(dir)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
return []CacheEntry{}, nil return []cacheEntry{}, nil
} }
return nil, err return nil, err
} }
@ -156,7 +156,7 @@ func (c *Cache) List(t backend.Type) ([]CacheEntry, error) {
return nil, err return nil, err
} }
entries := make([]CacheEntry, 0, len(fis)) entries := make([]cacheEntry, 0, len(fis))
for _, fi := range fis { for _, fi := range fis {
parts := strings.SplitN(fi.Name(), ".", 2) parts := strings.SplitN(fi.Name(), ".", 2)
@ -168,7 +168,7 @@ func (c *Cache) List(t backend.Type) ([]CacheEntry, error) {
continue continue
} }
e := CacheEntry{ID: id} e := cacheEntry{ID: id}
if len(parts) == 2 { if len(parts) == 2 {
e.Subtype = parts[1] e.Subtype = parts[1]