rpc

package
v0.0.0-...-d336b92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRouter

func ApplyRouter() func(chi.Router)

RPC service must be registered before applying this router!

func Post

func Post(w http.ResponseWriter, r *http.Request)

HTTP-POST JSON-RPC handler

func WebSocket

func WebSocket(w http.ResponseWriter, r *http.Request)

WebSockets JSON-RPC handler

Types

type Args

type Args struct {
	Id     string
	URL    string
	Params []string
}

type NoArgs

type NoArgs struct{}

type Pending

type Pending []string

type Running

type Running []internal.ProcessResponse

type Service

type Service struct {
	// contains filtered or unexported fields
}

func Container

func Container(
	db *internal.MemoryDB,
	mq *internal.MessageQueue,
	logger *slog.Logger,
) *Service

Dependency injection container.

func (*Service) Clear

func (s *Service) Clear(args string, killed *string) error

Remove a process from the db rendering it unusable if active

func (*Service) DirectoryTree

func (s *Service) DirectoryTree(args NoArgs, tree *[]string) error

Return a flattned tree of the download directory

func (*Service) Exec

func (s *Service) Exec(args internal.DownloadRequest, result *string) error

Exec spawns a Process. The result of the execution is the newly spawned process Id.

func (*Service) ExecPlaylist

func (s *Service) ExecPlaylist(args internal.DownloadRequest, result *string) error

Exec spawns a Process. The result of the execution is the newly spawned process Id.

func (*Service) Formats

func (s *Service) Formats(args Args, meta *internal.DownloadFormats) error

Progess retrieves available format for a given resource

func (*Service) FreeSpace

func (s *Service) FreeSpace(args NoArgs, free *uint64) error

FreeSpace gets the available from package sys util

func (*Service) Kill

func (s *Service) Kill(args string, killed *string) error

Kill kills a process given its id and remove it from the memoryDB

func (*Service) KillAll

func (s *Service) KillAll(args NoArgs, killed *string) error

KillAll kills all process unconditionally and removes them from the memory db

func (*Service) Pending

func (s *Service) Pending(args NoArgs, pending *Pending) error

Pending retrieves a slice of all Pending/Running processes ids

func (*Service) Progess

func (s *Service) Progess(args Args, progress *internal.DownloadProgress) error

Progess retrieves the Progress of a specific Process given its Id

func (*Service) Running

func (s *Service) Running(args NoArgs, running *Running) error

Running retrieves a slice of all Processes progress

func (*Service) UpdateExecutable

func (s *Service) UpdateExecutable(args NoArgs, updated *bool) error

Updates the yt-dlp binary using its builtin function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL