archive plugin
This commit is contained in:
parent
1912b5baf0
commit
a02733a926
4 changed files with 26 additions and 14 deletions
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
tstor.Run([]tstor.Plugin{
|
tstor.Run([]tstor.Plugin{
|
||||||
archive.Plugin,
|
archive.ArchivePlugin{},
|
||||||
qbittorrent.QBittorrentPlugin{},
|
qbittorrent.QBittorrentPlugin{},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,19 @@ const daemonName = "archive"
|
||||||
|
|
||||||
type ArchivePlugin struct{}
|
type ArchivePlugin struct{}
|
||||||
|
|
||||||
|
var _ tstor.Plugin = (*ArchivePlugin)(nil)
|
||||||
|
|
||||||
// Name implements tstor.Plugin.
|
// Name implements tstor.Plugin.
|
||||||
func (a *ArchivePlugin) Name() string {
|
func (ArchivePlugin) Name() string {
|
||||||
return daemonName
|
return daemonName
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ tstor.Plugin = (*ArchivePlugin)(nil)
|
var _ tstor.DaemonPlugin = (*ArchivePlugin)(nil)
|
||||||
|
|
||||||
var _ daemon.DaemonConstructor = NewDaemon
|
// NewDaemon implements tstor.DaemonPlugin.
|
||||||
|
func (a *ArchivePlugin) NewDaemon(context.Context, *koanf.Koanf) (daemon.Daemon, error) {
|
||||||
|
return &Daemon{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func NewDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error) {
|
func NewDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error) {
|
||||||
return &Daemon{}, nil
|
return &Daemon{}, nil
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"git.kmsign.ru/royalcat/tstor/server/src/daemon"
|
"git.kmsign.ru/royalcat/tstor/server/src/daemon"
|
||||||
"git.kmsign.ru/royalcat/tstor/server/src/logwrap"
|
"git.kmsign.ru/royalcat/tstor/server/src/logwrap"
|
||||||
"git.kmsign.ru/royalcat/tstor/server/src/vfs"
|
"git.kmsign.ru/royalcat/tstor/server/src/vfs"
|
||||||
|
"git.kmsign.ru/royalcat/tstor/server/tstor"
|
||||||
"github.com/anacrolix/torrent/metainfo"
|
"github.com/anacrolix/torrent/metainfo"
|
||||||
"github.com/anacrolix/torrent/types/infohash"
|
"github.com/anacrolix/torrent/types/infohash"
|
||||||
infohash_v2 "github.com/anacrolix/torrent/types/infohash-v2"
|
infohash_v2 "github.com/anacrolix/torrent/types/infohash-v2"
|
||||||
|
@ -26,6 +27,21 @@ import (
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type QBittorrentPlugin struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ tstor.Plugin = (*QBittorrentPlugin)(nil)
|
||||||
|
|
||||||
|
func (QBittorrentPlugin) Name() string {
|
||||||
|
return daemonName
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ tstor.DaemonPlugin = (*QBittorrentPlugin)(nil)
|
||||||
|
|
||||||
|
func (QBittorrentPlugin) NewDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error) {
|
||||||
|
return newDaemon(ctx, koanf)
|
||||||
|
}
|
||||||
|
|
||||||
var trace = otel.Tracer("git.kmsign.ru/royalcat/tstor/plugins/qbittorrent")
|
var trace = otel.Tracer("git.kmsign.ru/royalcat/tstor/plugins/qbittorrent")
|
||||||
|
|
||||||
type Daemon struct {
|
type Daemon struct {
|
||||||
|
@ -53,14 +69,7 @@ WebUI\Password_PBKDF2="@ByteArray(qef5I4wZBkDG+PP6/5mQwA==:LoTmorQM/QM5RHI4+dOiu
|
||||||
|
|
||||||
const daemonName = "qbittorrent"
|
const daemonName = "qbittorrent"
|
||||||
|
|
||||||
type QBittorrentPlugin struct {
|
func newDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error) {
|
||||||
}
|
|
||||||
|
|
||||||
func (QBittorrentPlugin) Name() string {
|
|
||||||
return daemonName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (QBittorrentPlugin) NewDaemon(ctx context.Context, koanf *koanf.Koanf) (daemon.Daemon, error) {
|
|
||||||
log := rlog.Component(daemonName)
|
log := rlog.Component(daemonName)
|
||||||
|
|
||||||
log.Debug(ctx, "QBittorrent plugin loaded. Starting qbittorrent-nox")
|
log.Debug(ctx, "QBittorrent plugin loaded. Starting qbittorrent-nox")
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"git.kmsign.ru/royalcat/tstor/server/src/daemon"
|
"git.kmsign.ru/royalcat/tstor/server/src/daemon"
|
||||||
"github.com/99designs/gqlgen/graphql"
|
|
||||||
"github.com/knadh/koanf/v2"
|
"github.com/knadh/koanf/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,5 +13,4 @@ type Plugin interface {
|
||||||
|
|
||||||
type DaemonPlugin interface {
|
type DaemonPlugin interface {
|
||||||
NewDaemon(context.Context, *koanf.Koanf) (daemon.Daemon, error)
|
NewDaemon(context.Context, *koanf.Koanf) (daemon.Daemon, error)
|
||||||
GraphQLExecutableSchema() graphql.ExecutableSchema
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue