Remove old name conversion from staggered versioning

This commit is contained in:
Jakob Borg 2015-05-03 08:14:17 +02:00
parent 1c31cf6319
commit d1528dcff0

View File

@ -10,7 +10,6 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/syncthing/syncthing/internal/osutil"
@ -35,32 +34,6 @@ type Staggered struct {
mutex sync.Mutex
}
// Rename versions with old version format
func (v Staggered) renameOld() {
err := filepath.Walk(v.versionsPath, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
if f.Mode().IsRegular() {
versionUnix, err := strconv.ParseInt(strings.Replace(filepath.Ext(path), ".v", "", 1), 10, 0)
if err == nil {
l.Infoln("Renaming file", path, "from old to new version format")
versiondate := time.Unix(versionUnix, 0)
name := path[:len(path)-len(filepath.Ext(path))]
err = osutil.Rename(path, taggedFilename(name, versiondate.Format(TimeFormat)))
if err != nil {
l.Infoln("Error renaming to new format", err)
}
}
}
return nil
})
if err != nil {
l.Infoln("Versioner: error scanning versions dir", err)
return
}
}
func NewStaggered(folderID, folderPath string, params map[string]string) Versioner {
maxAge, err := strconv.ParseInt(params["maxAge"], 10, 0)
if err != nil {
@ -102,9 +75,6 @@ func NewStaggered(folderID, folderPath string, params map[string]string) Version
l.Debugf("instantiated %#v", s)
}
// Rename version with old version format
s.renameOld()
go func() {
s.clean()
for _ = range time.Tick(time.Duration(cleanInterval) * time.Second) {