mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-17 16:53:19 +00:00
revert nesting levels to previous defaults
This commit is contained in:
@@ -95,14 +95,14 @@ func createTestSnapshotManager(testDir string) *SnapshotManager {
|
|||||||
os.RemoveAll(testDir)
|
os.RemoveAll(testDir)
|
||||||
os.MkdirAll(testDir, 0700)
|
os.MkdirAll(testDir, 0700)
|
||||||
|
|
||||||
storage, _ := CreateFileStorage(testDir, 1, false, 1)
|
storage, _ := CreateFileStorage(testDir, 2, false, 1)
|
||||||
storage.CreateDirectory(0, "chunks")
|
storage.CreateDirectory(0, "chunks")
|
||||||
storage.CreateDirectory(0, "snapshots")
|
storage.CreateDirectory(0, "snapshots")
|
||||||
config := CreateConfig()
|
config := CreateConfig()
|
||||||
snapshotManager := CreateSnapshotManager(config, storage)
|
snapshotManager := CreateSnapshotManager(config, storage)
|
||||||
|
|
||||||
cacheDir := path.Join(testDir, "cache")
|
cacheDir := path.Join(testDir, "cache")
|
||||||
snapshotCache, _ := CreateFileStorage(cacheDir, 1, false, 1)
|
snapshotCache, _ := CreateFileStorage(cacheDir, 2, false, 1)
|
||||||
snapshotCache.CreateDirectory(0, "chunks")
|
snapshotCache.CreateDirectory(0, "chunks")
|
||||||
snapshotCache.CreateDirectory(0, "snapshots")
|
snapshotCache.CreateDirectory(0, "snapshots")
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if isFileStorage {
|
if isFileStorage {
|
||||||
fileStorage, err := CreateFileStorage(storageURL, 1, isCacheNeeded, threads)
|
fileStorage, err := CreateFileStorage(storageURL, 2, isCacheNeeded, threads)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_ERROR("STORAGE_CREATE", "Failed to load the file storage at %s: %v", storageURL, err)
|
LOG_ERROR("STORAGE_CREATE", "Failed to load the file storage at %s: %v", storageURL, err)
|
||||||
return nil
|
return nil
|
||||||
@@ -164,7 +164,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(storageURL, "samba://") {
|
if strings.HasPrefix(storageURL, "samba://") {
|
||||||
fileStorage, err := CreateFileStorage(storageURL[8:], 1, true, threads)
|
fileStorage, err := CreateFileStorage(storageURL[8:], 2, true, threads)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_ERROR("STORAGE_CREATE", "Failed to load the file storage at %s: %v", storageURL, err)
|
LOG_ERROR("STORAGE_CREATE", "Failed to load the file storage at %s: %v", storageURL, err)
|
||||||
return nil
|
return nil
|
||||||
@@ -311,7 +311,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
|||||||
return checkHostKey(hostname, remote, key)
|
return checkHostKey(hostname, remote, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
sftpStorage, err := CreateSFTPStorage(server, port, username, storageDir, 1, authMethods, hostKeyChecker, threads)
|
sftpStorage, err := CreateSFTPStorage(server, port, username, storageDir, 2, authMethods, hostKeyChecker, threads)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_ERROR("STORAGE_CREATE", "Failed to load the SFTP storage at %s: %v", storageURL, err)
|
LOG_ERROR("STORAGE_CREATE", "Failed to load the SFTP storage at %s: %v", storageURL, err)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func init() {
|
|||||||
func loadStorage(localStoragePath string, threads int) (Storage, error) {
|
func loadStorage(localStoragePath string, threads int) (Storage, error) {
|
||||||
|
|
||||||
if testStorageName == "" || testStorageName == "file" {
|
if testStorageName == "" || testStorageName == "file" {
|
||||||
return CreateFileStorage(localStoragePath, 1, false, threads)
|
return CreateFileStorage(localStoragePath, 2, false, threads)
|
||||||
}
|
}
|
||||||
|
|
||||||
config, err := ioutil.ReadFile("test_storage.conf")
|
config, err := ioutil.ReadFile("test_storage.conf")
|
||||||
@@ -64,10 +64,10 @@ func loadStorage(localStoragePath string, threads int) (Storage, error) {
|
|||||||
if testStorageName == "flat" {
|
if testStorageName == "flat" {
|
||||||
return CreateFileStorage(localStoragePath, 0, false, threads)
|
return CreateFileStorage(localStoragePath, 0, false, threads)
|
||||||
} else if testStorageName == "samba" {
|
} else if testStorageName == "samba" {
|
||||||
return CreateFileStorage(localStoragePath, 1, true, threads)
|
return CreateFileStorage(localStoragePath, 2, true, threads)
|
||||||
} else if testStorageName == "sftp" {
|
} else if testStorageName == "sftp" {
|
||||||
port, _ := strconv.Atoi(storage["port"])
|
port, _ := strconv.Atoi(storage["port"])
|
||||||
return CreateSFTPStorageWithPassword(storage["server"], port, storage["username"], storage["directory"], 1, storage["password"], threads)
|
return CreateSFTPStorageWithPassword(storage["server"], port, storage["username"], storage["directory"], 2, storage["password"], threads)
|
||||||
} else if testStorageName == "s3" || testStorageName == "wasabi" {
|
} else if testStorageName == "s3" || testStorageName == "wasabi" {
|
||||||
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, true, false)
|
return CreateS3Storage(storage["region"], storage["endpoint"], storage["bucket"], storage["directory"], storage["access_key"], storage["secret_key"], threads, true, false)
|
||||||
} else if testStorageName == "s3c" {
|
} else if testStorageName == "s3c" {
|
||||||
|
|||||||
Reference in New Issue
Block a user