mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-01 01:41:21 -05:00
Create pkg for index disk implementation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package index
|
||||
package disk
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -1,7 +1,8 @@
|
||||
package index
|
||||
package disk
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/errors"
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/index"
|
||||
. "github.com/owncloud/ocis/accounts/pkg/indexer/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
@@ -89,7 +90,7 @@ func TestNonUniqueIndexSearch(t *testing.T) {
|
||||
_ = os.RemoveAll(dataPath)
|
||||
}
|
||||
|
||||
func getNonUniqueIdxSut(t *testing.T) (sut Index, dataPath string) {
|
||||
func getNonUniqueIdxSut(t *testing.T) (sut index.Index, dataPath string) {
|
||||
dataPath = WriteIndexTestData(t, TestData, "Id")
|
||||
sut = NewNonUniqueIndex("Pet", "Color", path.Join(dataPath, "pets"), path.Join(dataPath, "index.disk"))
|
||||
err := sut.Init()
|
||||
@@ -1,4 +1,4 @@
|
||||
package index
|
||||
package disk
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -1,7 +1,8 @@
|
||||
package index
|
||||
package disk
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/errors"
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/index"
|
||||
. "github.com/owncloud/ocis/accounts/pkg/indexer/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
@@ -114,7 +115,7 @@ func TestErrors(t *testing.T) {
|
||||
assert.True(t, errors.IsNotFoundErr(&errors.NotFoundErr{}))
|
||||
}
|
||||
|
||||
func getUniqueIdxSut(t *testing.T) (sut Index, dataPath string) {
|
||||
func getUniqueIdxSut(t *testing.T) (sut index.Index, dataPath string) {
|
||||
dataPath = WriteIndexTestData(t, TestData, "Id")
|
||||
sut = NewUniqueIndex("User", "Email", path.Join(dataPath, "users"), path.Join(dataPath, "indexer.disk"))
|
||||
err := sut.Init()
|
||||
@@ -3,7 +3,7 @@ package indexer
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/errors"
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/index"
|
||||
"github.com/owncloud/ocis/accounts/pkg/indexer/index/disk"
|
||||
"github.com/rs/zerolog"
|
||||
"path"
|
||||
)
|
||||
@@ -32,7 +32,7 @@ func (i Indexer) AddUniqueIndex(t interface{}, indexBy, pkName, entityDirName st
|
||||
fullDataPath := path.Join(i.config.DataDir, entityDirName)
|
||||
indexPath := path.Join(i.config.DataDir, i.config.IndexRootDirName)
|
||||
|
||||
idx := index.NewUniqueIndex(typeName, indexBy, fullDataPath, indexPath)
|
||||
idx := disk.NewUniqueIndex(typeName, indexBy, fullDataPath, indexPath)
|
||||
|
||||
i.indices.addIndex(typeName, pkName, idx)
|
||||
return idx.Init()
|
||||
@@ -43,7 +43,7 @@ func (i Indexer) AddNonUniqueIndex(t interface{}, indexBy, pkName, entityDirName
|
||||
fullDataPath := path.Join(i.config.DataDir, entityDirName)
|
||||
indexPath := path.Join(i.config.DataDir, i.config.IndexRootDirName)
|
||||
|
||||
idx := index.NewNonUniqueIndex(typeName, indexBy, fullDataPath, indexPath)
|
||||
idx := disk.NewNonUniqueIndex(typeName, indexBy, fullDataPath, indexPath)
|
||||
|
||||
i.indices.addIndex(typeName, pkName, idx)
|
||||
return idx.Init()
|
||||
|
||||
Reference in New Issue
Block a user