forked from TrueCloudLab/restic
Add type 'Index' to backend
This commit is contained in:
parent
8f3b91ba32
commit
87ce38b13a
5 changed files with 15 additions and 1 deletions
|
@ -13,7 +13,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func testBackend(b backend.Backend, t *testing.T) {
|
func testBackend(b backend.Backend, t *testing.T) {
|
||||||
for _, tpe := range []backend.Type{backend.Data, backend.Key, backend.Lock, backend.Snapshot, backend.Tree} {
|
for _, tpe := range []backend.Type{
|
||||||
|
backend.Data, backend.Key, backend.Lock,
|
||||||
|
backend.Snapshot, backend.Tree, backend.Index,
|
||||||
|
} {
|
||||||
// detect non-existing files
|
// detect non-existing files
|
||||||
for _, test := range TestStrings {
|
for _, test := range TestStrings {
|
||||||
id, err := backend.ParseID(test.id)
|
id, err := backend.ParseID(test.id)
|
||||||
|
|
|
@ -11,6 +11,7 @@ const (
|
||||||
Lock = "lock"
|
Lock = "lock"
|
||||||
Snapshot = "snapshot"
|
Snapshot = "snapshot"
|
||||||
Tree = "tree"
|
Tree = "tree"
|
||||||
|
Index = "index"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -31,6 +31,7 @@ func Open(dir string) (*Local, error) {
|
||||||
filepath.Join(dir, backend.Paths.Data),
|
filepath.Join(dir, backend.Paths.Data),
|
||||||
filepath.Join(dir, backend.Paths.Snapshots),
|
filepath.Join(dir, backend.Paths.Snapshots),
|
||||||
filepath.Join(dir, backend.Paths.Trees),
|
filepath.Join(dir, backend.Paths.Trees),
|
||||||
|
filepath.Join(dir, backend.Paths.Index),
|
||||||
filepath.Join(dir, backend.Paths.Locks),
|
filepath.Join(dir, backend.Paths.Locks),
|
||||||
filepath.Join(dir, backend.Paths.Keys),
|
filepath.Join(dir, backend.Paths.Keys),
|
||||||
filepath.Join(dir, backend.Paths.Temp),
|
filepath.Join(dir, backend.Paths.Temp),
|
||||||
|
@ -103,6 +104,7 @@ func Create(dir string) (*Local, error) {
|
||||||
filepath.Join(dir, backend.Paths.Data),
|
filepath.Join(dir, backend.Paths.Data),
|
||||||
filepath.Join(dir, backend.Paths.Snapshots),
|
filepath.Join(dir, backend.Paths.Snapshots),
|
||||||
filepath.Join(dir, backend.Paths.Trees),
|
filepath.Join(dir, backend.Paths.Trees),
|
||||||
|
filepath.Join(dir, backend.Paths.Index),
|
||||||
filepath.Join(dir, backend.Paths.Locks),
|
filepath.Join(dir, backend.Paths.Locks),
|
||||||
filepath.Join(dir, backend.Paths.Keys),
|
filepath.Join(dir, backend.Paths.Keys),
|
||||||
filepath.Join(dir, backend.Paths.Temp),
|
filepath.Join(dir, backend.Paths.Temp),
|
||||||
|
@ -284,6 +286,8 @@ func dirname(base string, t backend.Type, name string) string {
|
||||||
if len(name) > 2 {
|
if len(name) > 2 {
|
||||||
n = filepath.Join(n, name[:2])
|
n = filepath.Join(n, name[:2])
|
||||||
}
|
}
|
||||||
|
case backend.Index:
|
||||||
|
n = backend.Paths.Index
|
||||||
case backend.Lock:
|
case backend.Lock:
|
||||||
n = backend.Paths.Locks
|
n = backend.Paths.Locks
|
||||||
case backend.Key:
|
case backend.Key:
|
||||||
|
|
|
@ -7,6 +7,7 @@ var Paths = struct {
|
||||||
Data string
|
Data string
|
||||||
Snapshots string
|
Snapshots string
|
||||||
Trees string
|
Trees string
|
||||||
|
Index string
|
||||||
Locks string
|
Locks string
|
||||||
Keys string
|
Keys string
|
||||||
Temp string
|
Temp string
|
||||||
|
@ -16,6 +17,7 @@ var Paths = struct {
|
||||||
"data",
|
"data",
|
||||||
"snapshots",
|
"snapshots",
|
||||||
"trees",
|
"trees",
|
||||||
|
"index",
|
||||||
"locks",
|
"locks",
|
||||||
"keys",
|
"keys",
|
||||||
"tmp",
|
"tmp",
|
||||||
|
|
|
@ -79,6 +79,7 @@ func Open(dir string, program string, args ...string) (*SFTP, error) {
|
||||||
filepath.Join(dir, backend.Paths.Data),
|
filepath.Join(dir, backend.Paths.Data),
|
||||||
filepath.Join(dir, backend.Paths.Snapshots),
|
filepath.Join(dir, backend.Paths.Snapshots),
|
||||||
filepath.Join(dir, backend.Paths.Trees),
|
filepath.Join(dir, backend.Paths.Trees),
|
||||||
|
filepath.Join(dir, backend.Paths.Index),
|
||||||
filepath.Join(dir, backend.Paths.Locks),
|
filepath.Join(dir, backend.Paths.Locks),
|
||||||
filepath.Join(dir, backend.Paths.Keys),
|
filepath.Join(dir, backend.Paths.Keys),
|
||||||
filepath.Join(dir, backend.Paths.Version),
|
filepath.Join(dir, backend.Paths.Version),
|
||||||
|
@ -153,6 +154,7 @@ func Create(dir string, program string, args ...string) (*SFTP, error) {
|
||||||
filepath.Join(dir, backend.Paths.Data),
|
filepath.Join(dir, backend.Paths.Data),
|
||||||
filepath.Join(dir, backend.Paths.Snapshots),
|
filepath.Join(dir, backend.Paths.Snapshots),
|
||||||
filepath.Join(dir, backend.Paths.Trees),
|
filepath.Join(dir, backend.Paths.Trees),
|
||||||
|
filepath.Join(dir, backend.Paths.Index),
|
||||||
filepath.Join(dir, backend.Paths.Locks),
|
filepath.Join(dir, backend.Paths.Locks),
|
||||||
filepath.Join(dir, backend.Paths.Keys),
|
filepath.Join(dir, backend.Paths.Keys),
|
||||||
filepath.Join(dir, backend.Paths.Temp),
|
filepath.Join(dir, backend.Paths.Temp),
|
||||||
|
@ -408,6 +410,8 @@ func (r *SFTP) dirname(t backend.Type, name string) string {
|
||||||
if len(name) > 2 {
|
if len(name) > 2 {
|
||||||
n = filepath.Join(n, name[:2])
|
n = filepath.Join(n, name[:2])
|
||||||
}
|
}
|
||||||
|
case backend.Index:
|
||||||
|
n = backend.Paths.Index
|
||||||
case backend.Lock:
|
case backend.Lock:
|
||||||
n = backend.Paths.Locks
|
n = backend.Paths.Locks
|
||||||
case backend.Key:
|
case backend.Key:
|
||||||
|
|
Loading…
Reference in a new issue