From b6a84ecb0c0aec1d3f92335d30a7c040ebf03992 Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:19:18 +0200 Subject: [PATCH] lib/db: Remove unused keyer methods (#6723) Co-authored-by: greatroar <@> --- lib/db/keyer.go | 10 ---------- lib/db/keyer_test.go | 12 ------------ 2 files changed, 22 deletions(-) diff --git a/lib/db/keyer.go b/lib/db/keyer.go index f3e15feff..56daf68c3 100644 --- a/lib/db/keyer.go +++ b/lib/db/keyer.go @@ -80,7 +80,6 @@ type keyer interface { // global version key stuff GenerateGlobalVersionKey(key, folder, name []byte) (globalVersionKey, error) NameFromGlobalVersionKey(key []byte) []byte - FolderFromGlobalVersionKey(key []byte) ([]byte, bool) // block map key stuff (former BlockMap) GenerateBlockMapKey(key, folder, hash, name []byte) (blockMapKey, error) @@ -97,7 +96,6 @@ type keyer interface { // index IDs GenerateIndexIDKey(key, device, folder []byte) (indexIDKey, error) - DeviceFromIndexIDKey(key []byte) ([]byte, bool) // Mtimes GenerateMtimesKey(key, folder []byte) (mtimesKey, error) @@ -187,10 +185,6 @@ func (k defaultKeyer) NameFromGlobalVersionKey(key []byte) []byte { return key[keyPrefixLen+keyFolderLen:] } -func (k defaultKeyer) FolderFromGlobalVersionKey(key []byte) ([]byte, bool) { - return k.folderIdx.Val(binary.BigEndian.Uint32(key[keyPrefixLen:])) -} - type blockMapKey []byte func (k defaultKeyer) GenerateBlockMapKey(key, folder, hash, name []byte) (blockMapKey, error) { @@ -295,10 +289,6 @@ func (k defaultKeyer) GenerateIndexIDKey(key, device, folder []byte) (indexIDKey return key, nil } -func (k defaultKeyer) DeviceFromIndexIDKey(key []byte) ([]byte, bool) { - return k.deviceIdx.Val(binary.BigEndian.Uint32(key[keyPrefixLen:])) -} - type mtimesKey []byte func (k defaultKeyer) GenerateMtimesKey(key, folder []byte) (mtimesKey, error) { diff --git a/lib/db/keyer_test.go b/lib/db/keyer_test.go index 2317e14ca..46eeb7f72 100644 --- a/lib/db/keyer_test.go +++ b/lib/db/keyer_test.go @@ -58,22 +58,10 @@ func TestGlobalKey(t *testing.T) { t.Fatal(err) } - fld2, ok := db.keyer.FolderFromGlobalVersionKey(key) - if !ok { - t.Error("should have been found") - } - if !bytes.Equal(fld2, fld) { - t.Errorf("wrong folder %q != %q", fld2, fld) - } name2 := db.keyer.NameFromGlobalVersionKey(key) if !bytes.Equal(name2, name) { t.Errorf("wrong name %q != %q", name2, name) } - - _, ok = db.keyer.FolderFromGlobalVersionKey([]byte{1, 2, 3, 4, 5}) - if ok { - t.Error("should not have been found") - } } func TestSequenceKey(t *testing.T) {