Generating contents indexes via temporary LevelDB

This commit is contained in:
Andrey Smirnov
2017-02-21 19:09:51 +03:00
parent f58d2627c1
commit f2dc4eeec9
3 changed files with 107 additions and 32 deletions
+9 -1
View File
@@ -1,8 +1,9 @@
package deb
import (
"github.com/smira/aptly/database"
"sync"
"github.com/smira/aptly/database"
)
// CollectionFactory is a single place to generate all desired collections
@@ -21,6 +22,13 @@ func NewCollectionFactory(db database.Storage) *CollectionFactory {
return &CollectionFactory{Mutex: &sync.Mutex{}, db: db}
}
// TemporaryDB creates new temporary DB
//
// DB should be closed/droped after being used
func (factory *CollectionFactory) TemporaryDB() (database.Storage, error) {
return factory.db.CreateTemporary()
}
// PackageCollection returns (or creates) new PackageCollection
func (factory *CollectionFactory) PackageCollection() *PackageCollection {
factory.Lock()