Create torrent proto stub
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user