gql dir ls
This commit is contained in:
parent
6a1e338af4
commit
e576e62599
23 changed files with 1671 additions and 138 deletions
cmd/tstor
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
|
@ -14,20 +15,21 @@ import (
|
|||
"time"
|
||||
|
||||
"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/datastorage"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/service"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/store"
|
||||
"git.kmsign.ru/royalcat/tstor/src/host/vfs"
|
||||
"git.kmsign.ru/royalcat/tstor/src/telemetry"
|
||||
"github.com/urfave/cli/v2"
|
||||
wnfs "github.com/willscott/go-nfs"
|
||||
|
||||
_ "git.kmsign.ru/royalcat/tstor/pkg/rlog"
|
||||
"git.kmsign.ru/royalcat/tstor/src/export/fuse"
|
||||
"git.kmsign.ru/royalcat/tstor/src/export/httpfs"
|
||||
"git.kmsign.ru/royalcat/tstor/src/export/nfs"
|
||||
"git.kmsign.ru/royalcat/tstor/src/export/webdav"
|
||||
"git.kmsign.ru/royalcat/tstor/src/http"
|
||||
dlog "git.kmsign.ru/royalcat/tstor/src/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -65,7 +67,17 @@ func run(configPath string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("error loading configuration: %w", err)
|
||||
}
|
||||
dlog.Load(&conf.Log)
|
||||
// dlog.Load(&conf.Log)
|
||||
|
||||
if conf.OtelHttp != "" {
|
||||
ctx := context.Background()
|
||||
client, err := telemetry.Setup(ctx, conf.OtelHttp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer client.Shutdown(ctx)
|
||||
}
|
||||
|
||||
log := slog.Default().With("component", "run")
|
||||
|
||||
|
@ -113,7 +125,10 @@ func run(configPath string) error {
|
|||
c.AddDhtNodes(conf.TorrentClient.DHTNodes)
|
||||
defer c.Close()
|
||||
|
||||
ts := service.NewService(conf.SourceDir, c, st, excludedFilesStore, infoBytesStore, conf.TorrentClient.AddTimeout, conf.TorrentClient.ReadTimeout)
|
||||
ts, err := service.NewService(conf.SourceDir, conf.TorrentClient, c, st, excludedFilesStore, infoBytesStore, conf.TorrentClient.AddTimeout, conf.TorrentClient.ReadTimeout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating service: %w", err)
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(conf.SourceDir, 0744); err != nil {
|
||||
return fmt.Errorf("error creating data folder: %w", err)
|
||||
|
@ -226,9 +241,9 @@ func run(configPath string) error {
|
|||
}()
|
||||
|
||||
go func() {
|
||||
logFilename := filepath.Join(conf.Log.Path, dlog.FileName)
|
||||
logFilename := filepath.Join(conf.Log.Path, "logs")
|
||||
|
||||
err := http.New(nil, service.NewStats(), ts, logFilename, conf)
|
||||
err := delivery.New(nil, service.NewStats(), ts, sfs, logFilename, conf)
|
||||
if err != nil {
|
||||
log.Error("error initializing HTTP server", "error", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue