"fmt"
"io"
"io/ioutil"
- "log"
"os"
"path/filepath"
"runtime"
cfg.DownloadRateLimiter = ps.LeecherDownloadRateLimiter
}
cfg.Seed = false
- cfg.Debug = true
+ //cfg.Debug = true
if ps.ConfigureLeecher.Config != nil {
ps.ConfigureLeecher.Config(cfg)
}
func sqliteLeecherStorageTestCase(numConns int) leecherStorageTestCase {
return leecherStorageTestCase{
fmt.Sprintf("SqliteFile,NumConns=%v", numConns),
- sqliteClientStorageFactory(func(dataDir string) sqliteStorage.NewPiecesStorageOpts {
- return sqliteStorage.NewPiecesStorageOpts{
- NewPoolOpts: sqliteStorage.NewPoolOpts{
- Path: filepath.Join(dataDir, "sqlite.db"),
- NumConns: numConns,
- },
- }
+ sqliteClientStorageFactory(func(dataDir string) (opts sqliteStorage.NewPiecesStorageOpts) {
+ opts.Path = filepath.Join(dataDir, "sqlite.db")
+ opts.NumConns = numConns
+ return
}),
numConns,
}
{"Boltdb", storage.NewBoltDB, 0},
{"SqliteDirect", func(s string) storage.ClientImplCloser {
path := filepath.Join(s, "sqlite3.db")
- log.Print(path)
- cl, err := sqliteStorage.NewDirectStorage(sqliteStorage.NewDirectStorageOpts{
- NewPoolOpts: sqliteStorage.NewPoolOpts{
- Path: path,
- },
- ProvOpts: nil,
- })
+ var opts sqliteStorage.NewDirectStorageOpts
+ opts.Path = path
+ cl, err := sqliteStorage.NewDirectStorage(opts)
if err != nil {
panic(err)
}
sqliteLeecherStorageTestCase(2),
// This should use a number of connections equal to the number of CPUs
sqliteLeecherStorageTestCase(0),
- {"SqliteMemory", sqliteClientStorageFactory(func(dataDir string) sqliteStorage.NewPiecesStorageOpts {
- return sqliteStorage.NewPiecesStorageOpts{
- NewPoolOpts: sqliteStorage.NewPoolOpts{
- Memory: true,
- },
- }
+ {"SqliteMemory", sqliteClientStorageFactory(func(dataDir string) (opts sqliteStorage.NewPiecesStorageOpts) {
+ opts.Memory = true
+ return
}), 0},
} {
t.Run(fmt.Sprintf("LeecherStorage=%s", ls.name), func(t *testing.T) {