mirror of https://github.com/perkeep/perkeep.git
index: export NewMemoryIndex
Change-Id: Iaa6d3268ce0f6c531e37c97799deeb31c11eabdb
This commit is contained in:
parent
0ccf9ba3f1
commit
17a3faf2df
|
@ -23,7 +23,3 @@ func ExpReverseTimeString(s string) string {
|
|||
func ExpUnreverseTimeString(s string) string {
|
||||
return unreverseTimeString(s)
|
||||
}
|
||||
|
||||
func ExpNewMemoryIndex() *Index {
|
||||
return newMemoryIndex()
|
||||
}
|
||||
|
|
|
@ -44,15 +44,15 @@ func TestReverseTimeString(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIndex_Memory(t *testing.T) {
|
||||
indextest.Index(t, index.ExpNewMemoryIndex)
|
||||
indextest.Index(t, index.NewMemoryIndex)
|
||||
}
|
||||
|
||||
func TestPathsOfSignerTarget_Memory(t *testing.T) {
|
||||
indextest.PathsOfSignerTarget(t, index.ExpNewMemoryIndex)
|
||||
indextest.PathsOfSignerTarget(t, index.NewMemoryIndex)
|
||||
}
|
||||
|
||||
func TestFiles_Memory(t *testing.T) {
|
||||
indextest.Files(t, index.ExpNewMemoryIndex)
|
||||
indextest.Files(t, index.NewMemoryIndex)
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -32,7 +32,8 @@ func init() {
|
|||
blobserver.StorageConstructor(newMemoryIndexFromConfig))
|
||||
}
|
||||
|
||||
func newMemoryIndex() *Index {
|
||||
// NewMemoryIndex returns an Index backed only by memory, for use in tests.
|
||||
func NewMemoryIndex() *Index {
|
||||
db := memdb.New(nil)
|
||||
memStorage := &memKeys{db: db}
|
||||
return New(memStorage)
|
||||
|
@ -48,7 +49,7 @@ func newMemoryIndexFromConfig(ld blobserver.Loader, config jsonconfig.Obj) (blob
|
|||
return nil, err
|
||||
}
|
||||
|
||||
ix := newMemoryIndex()
|
||||
ix := NewMemoryIndex()
|
||||
ix.BlobSource = sto
|
||||
|
||||
// Good enough, for now:
|
||||
|
|
Loading…
Reference in New Issue