Skip to content

Commit

Permalink
Remove VFS Swift layout v1 and v2
Browse files Browse the repository at this point in the history
They have been deprecated a few years ago, and the V3 layout is really
better.
  • Loading branch information
nono committed Oct 24, 2023
1 parent 71255c8 commit 083f856
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 2,221 deletions.
2 changes: 1 addition & 1 deletion cmd/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var swiftCmdGroup = &cobra.Command{

var lsLayoutsCmd = &cobra.Command{
Use: "ls-layouts",
Short: `Count layouts by types (v1, v2a, v2b, v3a, v3b)`,
Short: `Count layouts by types (v3a, v3b, unknown)`,
Example: "$ cozy-stack swift ls-layouts",
RunE: func(cmd *cobra.Command, args []string) error {
ac := newAdminClient()
Expand Down
8 changes: 0 additions & 8 deletions model/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ func (i *Instance) MakeVFS() error {
i.vfs, err = vfsafero.New(i, index, disk, mutex, fsURL, i.DirName())
case config.SchemeSwift, config.SchemeSwiftSecure:
switch i.SwiftLayout {
case 0:
i.vfs, err = vfsswift.New(i, index, disk, mutex)
case 1:
i.vfs, err = vfsswift.NewV2(i, index, disk, mutex)
case 2:
i.vfs, err = vfsswift.NewV3(i, index, disk, mutex)
default:
Expand All @@ -258,10 +254,6 @@ func (i *Instance) ThumbsFS() vfs.Thumbser {
return vfsafero.NewThumbsFs(baseFS)
case config.SchemeSwift, config.SchemeSwiftSecure:
switch i.SwiftLayout {
case 0:
return vfsswift.NewThumbsFs(config.GetSwiftConnection(), i.Domain)
case 1:
return vfsswift.NewThumbsFsV2(config.GetSwiftConnection(), i)
case 2:
return vfsswift.NewThumbsFsV3(config.GetSwiftConnection(), i)
default:
Expand Down
2 changes: 1 addition & 1 deletion model/vfs/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestPermissions(t *testing.T) {
testutils.NeedCouchdb(t)

aferoFS := makeAferoFS(t)
swiftFS := makeSwiftFS(t, 2)
swiftFS := makeSwiftFS(t)

var tests = []struct {
name string
Expand Down
18 changes: 4 additions & 14 deletions model/vfs/vfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestVfs(t *testing.T) {
testutils.NeedCouchdb(t)

aferoFS := makeAferoFS(t)
swiftFS := makeSwiftFS(t, 2)
swiftFS := makeSwiftFS(t)

var tests = []struct {
name string
Expand Down Expand Up @@ -819,7 +819,7 @@ func makeAferoFS(t *testing.T) vfs.VFS {
return aferoFs
}

func makeSwiftFS(t *testing.T, layout int) vfs.VFS {
func makeSwiftFS(t *testing.T) vfs.VFS {
t.Helper()

db := &contexter{0, "io.cozy.vfs.test", "io.cozy.vfs.test", "cozy_beta"}
Expand All @@ -836,18 +836,8 @@ func makeSwiftFS(t *testing.T, layout int) vfs.VFS {
},
}))

var swiftFs vfs.VFS
switch layout {
case 0:
mutex = config.Lock().ReadWrite(db, "vfs-swift-test")
swiftFs, err = vfsswift.New(db, index, &diskImpl{}, mutex)
case 1:
mutex = config.Lock().ReadWrite(db, "vfs-swiftv2-test")
swiftFs, err = vfsswift.NewV2(db, index, &diskImpl{}, mutex)
case 2:
mutex = config.Lock().ReadWrite(db, "vfs-swiftv3-test")
swiftFs, err = vfsswift.NewV3(db, index, &diskImpl{}, mutex)
}
mutex = config.Lock().ReadWrite(db, "vfs-swiftv3-test")
swiftFs, err := vfsswift.NewV3(db, index, &diskImpl{}, mutex)
require.NoError(t, err)

require.NoError(t, couchdb.ResetDB(db, consts.Files))
Expand Down
204 changes: 0 additions & 204 deletions model/vfs/vfsswift/fsck_v1.go

This file was deleted.

Loading

0 comments on commit 083f856

Please sign in to comment.