diff --git a/backend/backend_test.go b/backend/backend_test.go index 36a91cec6..49e151336 100644 --- a/backend/backend_test.go +++ b/backend/backend_test.go @@ -13,7 +13,10 @@ import ( ) 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 for _, test := range TestStrings { id, err := backend.ParseID(test.id) diff --git a/backend/interface.go b/backend/interface.go index e96c6ab7c..2256212a8 100644 --- a/backend/interface.go +++ b/backend/interface.go @@ -11,6 +11,7 @@ const ( Lock = "lock" Snapshot = "snapshot" Tree = "tree" + Index = "index" ) const ( diff --git a/backend/local/local.go b/backend/local/local.go index bc9cf3b7f..ee1430639 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -31,6 +31,7 @@ func Open(dir string) (*Local, error) { filepath.Join(dir, backend.Paths.Data), filepath.Join(dir, backend.Paths.Snapshots), filepath.Join(dir, backend.Paths.Trees), + filepath.Join(dir, backend.Paths.Index), filepath.Join(dir, backend.Paths.Locks), filepath.Join(dir, backend.Paths.Keys), 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.Snapshots), filepath.Join(dir, backend.Paths.Trees), + filepath.Join(dir, backend.Paths.Index), filepath.Join(dir, backend.Paths.Locks), filepath.Join(dir, backend.Paths.Keys), filepath.Join(dir, backend.Paths.Temp), @@ -284,6 +286,8 @@ func dirname(base string, t backend.Type, name string) string { if len(name) > 2 { n = filepath.Join(n, name[:2]) } + case backend.Index: + n = backend.Paths.Index case backend.Lock: n = backend.Paths.Locks case backend.Key: diff --git a/backend/paths.go b/backend/paths.go index aa73bf6eb..4b1246e13 100644 --- a/backend/paths.go +++ b/backend/paths.go @@ -7,6 +7,7 @@ var Paths = struct { Data string Snapshots string Trees string + Index string Locks string Keys string Temp string @@ -16,6 +17,7 @@ var Paths = struct { "data", "snapshots", "trees", + "index", "locks", "keys", "tmp", diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 4237efae4..5a942be50 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -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.Snapshots), filepath.Join(dir, backend.Paths.Trees), + filepath.Join(dir, backend.Paths.Index), filepath.Join(dir, backend.Paths.Locks), filepath.Join(dir, backend.Paths.Keys), 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.Snapshots), filepath.Join(dir, backend.Paths.Trees), + filepath.Join(dir, backend.Paths.Index), filepath.Join(dir, backend.Paths.Locks), filepath.Join(dir, backend.Paths.Keys), filepath.Join(dir, backend.Paths.Temp), @@ -408,6 +410,8 @@ func (r *SFTP) dirname(t backend.Type, name string) string { if len(name) > 2 { n = filepath.Join(n, name[:2]) } + case backend.Index: + n = backend.Paths.Index case backend.Lock: n = backend.Paths.Locks case backend.Key: