From ff38d10fbfb384906734cb50b49e69935450c9d2 Mon Sep 17 00:00:00 2001 From: royalcat Date: Sun, 27 Oct 2024 01:19:16 +0300 Subject: [PATCH] rename daemons --- .gqlgen.yml | 6 +++--- cmd/tstor/main.go | 8 ++++---- src/{sources => daemons}/qbittorrent/api.go | 0 src/{sources => daemons}/qbittorrent/client.go | 0 src/{sources => daemons}/qbittorrent/daemon.go | 2 +- src/{sources => daemons}/qbittorrent/fs.go | 0 src/{sources => daemons}/qbittorrent/install.go | 0 src/{sources => daemons}/qbittorrent/install_test.go | 0 src/{sources => daemons}/storage.go | 6 +++--- src/{sources => daemons}/torrent/client.go | 0 src/{sources => daemons}/torrent/controller.go | 0 src/{sources => daemons}/torrent/daemon.go | 2 +- src/{sources => daemons}/torrent/daemon_load.go | 0 src/{sources => daemons}/torrent/daemon_stats.go | 0 src/{sources => daemons}/torrent/dht_fileitem_store.go | 0 src/{sources => daemons}/torrent/dup_cache.go | 0 src/{sources => daemons}/torrent/file_controller.go | 0 src/{sources => daemons}/torrent/fs.go | 0 src/{sources => daemons}/torrent/fs_test.go | 0 src/{sources => daemons}/torrent/infobytes.go | 0 src/{sources => daemons}/torrent/metrics.go | 0 src/{sources => daemons}/torrent/peer_store.go | 0 src/{sources => daemons}/torrent/piece_completion.go | 0 .../torrent/piece_completion_test.go | 0 src/{sources => daemons}/torrent/queue.go | 0 src/{sources => daemons}/torrent/setup.go | 0 src/{sources => daemons}/torrent/stats.go | 0 src/{sources => daemons}/torrent/storage.go | 0 src/{sources => daemons}/torrent/storage_dedupe.go | 0 src/{sources => daemons}/torrent/storage_open.go | 0 src/{sources => daemons}/ytdlp/controller.go | 0 src/{sources => daemons}/ytdlp/daemon.go | 0 src/{sources => daemons}/ytdlp/fs.go | 0 src/{sources => daemons}/ytdlp/tasks.go | 0 src/{sources => daemons}/ytdlp/ytdlp.go | 0 src/delivery/graphql/generated.go | 10 +++++----- src/delivery/graphql/model/entry.go | 2 +- src/delivery/graphql/model/mappers.go | 2 +- src/delivery/graphql/model/models_gen.go | 2 +- src/delivery/graphql/resolver/resolver.go | 4 ++-- .../graphql/resolver/torrent_query.resolvers.go | 2 +- src/delivery/http.go | 4 ++-- src/delivery/router.go | 4 ++-- 43 files changed, 27 insertions(+), 27 deletions(-) rename src/{sources => daemons}/qbittorrent/api.go (100%) rename src/{sources => daemons}/qbittorrent/client.go (100%) rename src/{sources => daemons}/qbittorrent/daemon.go (99%) rename src/{sources => daemons}/qbittorrent/fs.go (100%) rename src/{sources => daemons}/qbittorrent/install.go (100%) rename src/{sources => daemons}/qbittorrent/install_test.go (100%) rename src/{sources => daemons}/storage.go (84%) rename src/{sources => daemons}/torrent/client.go (100%) rename src/{sources => daemons}/torrent/controller.go (100%) rename src/{sources => daemons}/torrent/daemon.go (98%) rename src/{sources => daemons}/torrent/daemon_load.go (100%) rename src/{sources => daemons}/torrent/daemon_stats.go (100%) rename src/{sources => daemons}/torrent/dht_fileitem_store.go (100%) rename src/{sources => daemons}/torrent/dup_cache.go (100%) rename src/{sources => daemons}/torrent/file_controller.go (100%) rename src/{sources => daemons}/torrent/fs.go (100%) rename src/{sources => daemons}/torrent/fs_test.go (100%) rename src/{sources => daemons}/torrent/infobytes.go (100%) rename src/{sources => daemons}/torrent/metrics.go (100%) rename src/{sources => daemons}/torrent/peer_store.go (100%) rename src/{sources => daemons}/torrent/piece_completion.go (100%) rename src/{sources => daemons}/torrent/piece_completion_test.go (100%) rename src/{sources => daemons}/torrent/queue.go (100%) rename src/{sources => daemons}/torrent/setup.go (100%) rename src/{sources => daemons}/torrent/stats.go (100%) rename src/{sources => daemons}/torrent/storage.go (100%) rename src/{sources => daemons}/torrent/storage_dedupe.go (100%) rename src/{sources => daemons}/torrent/storage_open.go (100%) rename src/{sources => daemons}/ytdlp/controller.go (100%) rename src/{sources => daemons}/ytdlp/daemon.go (100%) rename src/{sources => daemons}/ytdlp/fs.go (100%) rename src/{sources => daemons}/ytdlp/tasks.go (100%) rename src/{sources => daemons}/ytdlp/ytdlp.go (100%) diff --git a/.gqlgen.yml b/.gqlgen.yml index 80a8256..521a6cf 100644 --- a/.gqlgen.yml +++ b/.gqlgen.yml @@ -27,11 +27,11 @@ models: Torrent: extraFields: T: - type: "*git.kmsign.ru/royalcat/tstor/src/sources/torrent.Controller" + type: "*git.kmsign.ru/royalcat/tstor/src/daemons/torrent.Controller" TorrentFile: extraFields: F: - type: "*git.kmsign.ru/royalcat/tstor/src/sources/torrent.FileController" + type: "*git.kmsign.ru/royalcat/tstor/src/daemons/torrent.FileController" TorrentPeer: extraFields: F: @@ -45,7 +45,7 @@ models: TorrentFS: extraFields: FS: - type: "*git.kmsign.ru/royalcat/tstor/src/sources/torrent.TorrentFS" + type: "*git.kmsign.ru/royalcat/tstor/src/daemons/torrent.TorrentFS" ResolverFS: extraFields: FS: diff --git a/cmd/tstor/main.go b/cmd/tstor/main.go index 96e922e..58fec83 100644 --- a/cmd/tstor/main.go +++ b/cmd/tstor/main.go @@ -17,10 +17,10 @@ import ( wnfs "git.kmsign.ru/royalcat/tstor/pkg/go-nfs" "git.kmsign.ru/royalcat/tstor/pkg/rlog" "git.kmsign.ru/royalcat/tstor/src/config" + "git.kmsign.ru/royalcat/tstor/src/daemons" + "git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/ytdlp" "git.kmsign.ru/royalcat/tstor/src/delivery" - "git.kmsign.ru/royalcat/tstor/src/sources" - "git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent" - "git.kmsign.ru/royalcat/tstor/src/sources/ytdlp" "git.kmsign.ru/royalcat/tstor/src/telemetry" "git.kmsign.ru/royalcat/tstor/src/vfs" "github.com/go-git/go-billy/v5/osfs" @@ -109,7 +109,7 @@ func run(configPath string) error { return fmt.Errorf("error creating qbittorrent daemon: %w", err) } - sfs := sources.NewHostedFS( + sfs := daemons.NewHostedFS( vfs.NewCtxBillyFs("/", ctxbilly.WrapFileSystem(sourceFs)), qtdaemon, ytdlpsrv, ) diff --git a/src/sources/qbittorrent/api.go b/src/daemons/qbittorrent/api.go similarity index 100% rename from src/sources/qbittorrent/api.go rename to src/daemons/qbittorrent/api.go diff --git a/src/sources/qbittorrent/client.go b/src/daemons/qbittorrent/client.go similarity index 100% rename from src/sources/qbittorrent/client.go rename to src/daemons/qbittorrent/client.go diff --git a/src/sources/qbittorrent/daemon.go b/src/daemons/qbittorrent/daemon.go similarity index 99% rename from src/sources/qbittorrent/daemon.go rename to src/daemons/qbittorrent/daemon.go index 38e870d..580d297 100644 --- a/src/sources/qbittorrent/daemon.go +++ b/src/daemons/qbittorrent/daemon.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel" ) -var trace = otel.Tracer("git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent") +var trace = otel.Tracer("git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent") type Daemon struct { proc *os.Process diff --git a/src/sources/qbittorrent/fs.go b/src/daemons/qbittorrent/fs.go similarity index 100% rename from src/sources/qbittorrent/fs.go rename to src/daemons/qbittorrent/fs.go diff --git a/src/sources/qbittorrent/install.go b/src/daemons/qbittorrent/install.go similarity index 100% rename from src/sources/qbittorrent/install.go rename to src/daemons/qbittorrent/install.go diff --git a/src/sources/qbittorrent/install_test.go b/src/daemons/qbittorrent/install_test.go similarity index 100% rename from src/sources/qbittorrent/install_test.go rename to src/daemons/qbittorrent/install_test.go diff --git a/src/sources/storage.go b/src/daemons/storage.go similarity index 84% rename from src/sources/storage.go rename to src/daemons/storage.go index ca97548..df121f8 100644 --- a/src/sources/storage.go +++ b/src/daemons/storage.go @@ -1,10 +1,10 @@ -package sources +package daemons import ( "context" - "git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent" - "git.kmsign.ru/royalcat/tstor/src/sources/ytdlp" + "git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/ytdlp" "git.kmsign.ru/royalcat/tstor/src/vfs" ) diff --git a/src/sources/torrent/client.go b/src/daemons/torrent/client.go similarity index 100% rename from src/sources/torrent/client.go rename to src/daemons/torrent/client.go diff --git a/src/sources/torrent/controller.go b/src/daemons/torrent/controller.go similarity index 100% rename from src/sources/torrent/controller.go rename to src/daemons/torrent/controller.go diff --git a/src/sources/torrent/daemon.go b/src/daemons/torrent/daemon.go similarity index 98% rename from src/sources/torrent/daemon.go rename to src/daemons/torrent/daemon.go index 934a322..230eb17 100644 --- a/src/sources/torrent/daemon.go +++ b/src/daemons/torrent/daemon.go @@ -27,7 +27,7 @@ import ( "github.com/royalcat/kv" ) -const instrument = "git.kmsign.ru/royalcat/tstor/sources/torrent" +const instrument = "git.kmsign.ru/royalcat/tstor/daemons/torrent" var ( tracer = otel.Tracer(instrument, trace.WithInstrumentationAttributes(attribute.String("component", "torrent-daemon"))) diff --git a/src/sources/torrent/daemon_load.go b/src/daemons/torrent/daemon_load.go similarity index 100% rename from src/sources/torrent/daemon_load.go rename to src/daemons/torrent/daemon_load.go diff --git a/src/sources/torrent/daemon_stats.go b/src/daemons/torrent/daemon_stats.go similarity index 100% rename from src/sources/torrent/daemon_stats.go rename to src/daemons/torrent/daemon_stats.go diff --git a/src/sources/torrent/dht_fileitem_store.go b/src/daemons/torrent/dht_fileitem_store.go similarity index 100% rename from src/sources/torrent/dht_fileitem_store.go rename to src/daemons/torrent/dht_fileitem_store.go diff --git a/src/sources/torrent/dup_cache.go b/src/daemons/torrent/dup_cache.go similarity index 100% rename from src/sources/torrent/dup_cache.go rename to src/daemons/torrent/dup_cache.go diff --git a/src/sources/torrent/file_controller.go b/src/daemons/torrent/file_controller.go similarity index 100% rename from src/sources/torrent/file_controller.go rename to src/daemons/torrent/file_controller.go diff --git a/src/sources/torrent/fs.go b/src/daemons/torrent/fs.go similarity index 100% rename from src/sources/torrent/fs.go rename to src/daemons/torrent/fs.go diff --git a/src/sources/torrent/fs_test.go b/src/daemons/torrent/fs_test.go similarity index 100% rename from src/sources/torrent/fs_test.go rename to src/daemons/torrent/fs_test.go diff --git a/src/sources/torrent/infobytes.go b/src/daemons/torrent/infobytes.go similarity index 100% rename from src/sources/torrent/infobytes.go rename to src/daemons/torrent/infobytes.go diff --git a/src/sources/torrent/metrics.go b/src/daemons/torrent/metrics.go similarity index 100% rename from src/sources/torrent/metrics.go rename to src/daemons/torrent/metrics.go diff --git a/src/sources/torrent/peer_store.go b/src/daemons/torrent/peer_store.go similarity index 100% rename from src/sources/torrent/peer_store.go rename to src/daemons/torrent/peer_store.go diff --git a/src/sources/torrent/piece_completion.go b/src/daemons/torrent/piece_completion.go similarity index 100% rename from src/sources/torrent/piece_completion.go rename to src/daemons/torrent/piece_completion.go diff --git a/src/sources/torrent/piece_completion_test.go b/src/daemons/torrent/piece_completion_test.go similarity index 100% rename from src/sources/torrent/piece_completion_test.go rename to src/daemons/torrent/piece_completion_test.go diff --git a/src/sources/torrent/queue.go b/src/daemons/torrent/queue.go similarity index 100% rename from src/sources/torrent/queue.go rename to src/daemons/torrent/queue.go diff --git a/src/sources/torrent/setup.go b/src/daemons/torrent/setup.go similarity index 100% rename from src/sources/torrent/setup.go rename to src/daemons/torrent/setup.go diff --git a/src/sources/torrent/stats.go b/src/daemons/torrent/stats.go similarity index 100% rename from src/sources/torrent/stats.go rename to src/daemons/torrent/stats.go diff --git a/src/sources/torrent/storage.go b/src/daemons/torrent/storage.go similarity index 100% rename from src/sources/torrent/storage.go rename to src/daemons/torrent/storage.go diff --git a/src/sources/torrent/storage_dedupe.go b/src/daemons/torrent/storage_dedupe.go similarity index 100% rename from src/sources/torrent/storage_dedupe.go rename to src/daemons/torrent/storage_dedupe.go diff --git a/src/sources/torrent/storage_open.go b/src/daemons/torrent/storage_open.go similarity index 100% rename from src/sources/torrent/storage_open.go rename to src/daemons/torrent/storage_open.go diff --git a/src/sources/ytdlp/controller.go b/src/daemons/ytdlp/controller.go similarity index 100% rename from src/sources/ytdlp/controller.go rename to src/daemons/ytdlp/controller.go diff --git a/src/sources/ytdlp/daemon.go b/src/daemons/ytdlp/daemon.go similarity index 100% rename from src/sources/ytdlp/daemon.go rename to src/daemons/ytdlp/daemon.go diff --git a/src/sources/ytdlp/fs.go b/src/daemons/ytdlp/fs.go similarity index 100% rename from src/sources/ytdlp/fs.go rename to src/daemons/ytdlp/fs.go diff --git a/src/sources/ytdlp/tasks.go b/src/daemons/ytdlp/tasks.go similarity index 100% rename from src/sources/ytdlp/tasks.go rename to src/daemons/ytdlp/tasks.go diff --git a/src/sources/ytdlp/ytdlp.go b/src/daemons/ytdlp/ytdlp.go similarity index 100% rename from src/sources/ytdlp/ytdlp.go rename to src/daemons/ytdlp/ytdlp.go diff --git a/src/delivery/graphql/generated.go b/src/delivery/graphql/generated.go index 287fdcc..72375db 100644 --- a/src/delivery/graphql/generated.go +++ b/src/delivery/graphql/generated.go @@ -1055,17 +1055,17 @@ interface Progress { current: Int! total: Int! }`, BuiltIn: false}, - {Name: "../../../graphql/sources/qbittorrent_query.graphql", Input: `type QBitTorrentDaemonQuery { + {Name: "../../../graphql/daemons/qbittorrent_query.graphql", Input: `type QBitTorrentDaemonQuery { torrents: [QTorrent!]! @resolver } `, BuiltIn: false}, - {Name: "../../../graphql/sources/qbittorrent_types.graphql", Input: `type QTorrent { + {Name: "../../../graphql/daemons/qbittorrent_types.graphql", Input: `type QTorrent { name: String! hash: String! sourceFiles: [String!]! @resolver } `, BuiltIn: false}, - {Name: "../../../graphql/sources/torrent_mutation.graphql", Input: `type TorrentDaemonMutation { + {Name: "../../../graphql/daemons/torrent_mutation.graphql", Input: `type TorrentDaemonMutation { validateTorrent(filter: TorrentFilter!): Boolean! @resolver setTorrentPriority( infohash: String! @@ -1084,7 +1084,7 @@ type DownloadTorrentResponse { task: Task } `, BuiltIn: false}, - {Name: "../../../graphql/sources/torrent_query.graphql", Input: `type TorrentDaemonQuery { + {Name: "../../../graphql/daemons/torrent_query.graphql", Input: `type TorrentDaemonQuery { torrents(filter: TorrentsFilter): [Torrent!]! @resolver clientStats: TorrentClientStats! @resolver statsHistory(since: DateTime!, infohash: String): [TorrentStats!]! @resolver @@ -1114,7 +1114,7 @@ input TorrentFilter @oneOf { # pathGlob: String! } `, BuiltIn: false}, - {Name: "../../../graphql/sources/torrent_types.graphql", Input: `type Torrent { + {Name: "../../../graphql/daemons/torrent_types.graphql", Input: `type Torrent { name: String! @resolver infohash: String! bytesCompleted: Int! diff --git a/src/delivery/graphql/model/entry.go b/src/delivery/graphql/model/entry.go index 4d46797..e5f01ee 100644 --- a/src/delivery/graphql/model/entry.go +++ b/src/delivery/graphql/model/entry.go @@ -3,7 +3,7 @@ package model import ( "context" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" "git.kmsign.ru/royalcat/tstor/src/vfs" ) diff --git a/src/delivery/graphql/model/mappers.go b/src/delivery/graphql/model/mappers.go index b3ea223..31de5f9 100644 --- a/src/delivery/graphql/model/mappers.go +++ b/src/delivery/graphql/model/mappers.go @@ -3,7 +3,7 @@ package model import ( "context" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" atorrent "github.com/anacrolix/torrent" ) diff --git a/src/delivery/graphql/model/models_gen.go b/src/delivery/graphql/model/models_gen.go index af24549..26fafc3 100644 --- a/src/delivery/graphql/model/models_gen.go +++ b/src/delivery/graphql/model/models_gen.go @@ -5,7 +5,7 @@ package model import ( "time" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" "git.kmsign.ru/royalcat/tstor/src/vfs" torrent1 "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/types" diff --git a/src/delivery/graphql/resolver/resolver.go b/src/delivery/graphql/resolver/resolver.go index afb2ce6..c443a86 100644 --- a/src/delivery/graphql/resolver/resolver.go +++ b/src/delivery/graphql/resolver/resolver.go @@ -1,8 +1,8 @@ package resolver import ( - "git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" "git.kmsign.ru/royalcat/tstor/src/vfs" "github.com/go-git/go-billy/v5" ) diff --git a/src/delivery/graphql/resolver/torrent_query.resolvers.go b/src/delivery/graphql/resolver/torrent_query.resolvers.go index 718db0e..906fefb 100644 --- a/src/delivery/graphql/resolver/torrent_query.resolvers.go +++ b/src/delivery/graphql/resolver/torrent_query.resolvers.go @@ -10,9 +10,9 @@ import ( "strings" "time" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" graph "git.kmsign.ru/royalcat/tstor/src/delivery/graphql" "git.kmsign.ru/royalcat/tstor/src/delivery/graphql/model" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" tinfohash "github.com/anacrolix/torrent/types/infohash" ) diff --git a/src/delivery/http.go b/src/delivery/http.go index b8bd96f..90cbd08 100644 --- a/src/delivery/http.go +++ b/src/delivery/http.go @@ -7,8 +7,8 @@ import ( "git.kmsign.ru/royalcat/tstor/pkg/rlog" "git.kmsign.ru/royalcat/tstor/src/config" - "git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" "git.kmsign.ru/royalcat/tstor/src/vfs" echopprof "github.com/labstack/echo-contrib/pprof" "github.com/labstack/echo/v4" diff --git a/src/delivery/router.go b/src/delivery/router.go index 6fa5f82..d274c0f 100644 --- a/src/delivery/router.go +++ b/src/delivery/router.go @@ -4,10 +4,10 @@ import ( "context" "net/http" + "git.kmsign.ru/royalcat/tstor/src/daemons/qbittorrent" + "git.kmsign.ru/royalcat/tstor/src/daemons/torrent" graph "git.kmsign.ru/royalcat/tstor/src/delivery/graphql" "git.kmsign.ru/royalcat/tstor/src/delivery/graphql/resolver" - "git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent" - "git.kmsign.ru/royalcat/tstor/src/sources/torrent" "git.kmsign.ru/royalcat/tstor/src/vfs" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/handler"