refactor torrent
This commit is contained in:
parent
99cdd5471e
commit
991c15fdef
33 changed files with 223 additions and 275 deletions
cmd/tstor
|
@ -19,7 +19,7 @@ import (
|
|||
"git.kmsign.ru/royalcat/tstor/src/config"
|
||||
"git.kmsign.ru/royalcat/tstor/src/delivery"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/service"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/torrent"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/vfs"
|
||||
"git.kmsign.ru/royalcat/tstor/src/telemetry"
|
||||
"github.com/go-git/go-billy/v5/osfs"
|
||||
|
@ -90,12 +90,12 @@ func run(configPath string) error {
|
|||
}
|
||||
|
||||
sourceFs := osfs.New(conf.SourceDir, osfs.WithBoundOS())
|
||||
srv, err := service.New(sourceFs, conf.TorrentClient)
|
||||
srv, err := torrent.NewService(sourceFs, conf.TorrentClient)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating service: %w", err)
|
||||
}
|
||||
|
||||
sfs := host.NewTorrentStorage(
|
||||
sfs := host.NewHostedFS(
|
||||
vfs.NewCtxBillyFs("/", ctxbilly.WrapFileSystem(sourceFs)),
|
||||
srv,
|
||||
)
|
||||
|
@ -174,7 +174,7 @@ func run(configPath string) error {
|
|||
go func() {
|
||||
logFilename := filepath.Join(conf.Log.Path, "logs")
|
||||
|
||||
err := delivery.New(nil, service.NewStats(), srv, sfs, logFilename, conf)
|
||||
err := delivery.New(nil, srv, sfs, logFilename, conf)
|
||||
if err != nil {
|
||||
log.Error(ctx, "error initializing HTTP server", rlog.Error(err))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue