Create torrent proto stub

This commit is contained in:
Alexander
2026-05-06 22:26:40 +02:00
parent 3249bdc35c
commit 36416081c1
5 changed files with 105 additions and 26 deletions
+34
View File
@@ -0,0 +1,34 @@
package torrent
import (
"context"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
pb "homelab.lan/music-agregator/gen/music_agregator/torrent/v1"
"homelab.lan/music-agregator/internal/config"
)
type TorrentServer struct {
service *TorrentService
pb.UnimplementedTorrentServiceServer
}
func NewTorrentServer(cfg config.Config) (*TorrentServer, error) {
service, err := NewIndexerService(cfg)
if err != nil {
log.Err(err).Msg("Failed to initialize IndexerService")
return nil, err
}
return &TorrentServer{service: service}, nil
}
func (server *TorrentServer) List(ctx context.Context, req *pb.ListRequest) (*pb.ListResponse, error) {
return nil, nil
}
func (s *TorrentServer) Register(server *grpc.Server) {
pb.RegisterTorrentServiceServer(server, s)
}
+11
View File
@@ -0,0 +1,11 @@
package torrent
import "homelab.lan/music-agregator/internal/config"
type TorrentService struct {
config config.Config
}
func NewIndexerService(cfg config.Config) (*TorrentService, error) {
return &TorrentService{config: cfg}, nil
}