library

package
v0.0.0-...-d771ed5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package library manages Pilot library records and their series counts.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("library not found")

ErrNotFound is returned when a library does not exist.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Name                    string
	RootPath                string
	DefaultQualityProfileID string
	NamingFormat            *string
	FolderFormat            *string
	MinFreeSpaceGB          int
	Tags                    []string
}

CreateRequest carries the fields needed to create a library.

type Library

type Library struct {
	ID                      string
	Name                    string
	RootPath                string
	DefaultQualityProfileID string
	NamingFormat            *string
	FolderFormat            *string
	MinFreeSpaceGB          int
	Tags                    []string
	CreatedAt               time.Time
	UpdatedAt               time.Time
}

Library is the domain representation of a library record.

type Service

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

Service manages library records.

func NewService

func NewService(q db.Querier, bus *events.Bus) *Service

NewService creates a new Service backed by the given querier and event bus.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (Library, error)

Create inserts a new library and returns the persisted domain type.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete removes a library by ID. Returns ErrNotFound if the library does not exist.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Library, error)

Get returns a library by ID. Returns ErrNotFound if no library with that ID exists.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Library, error)

List returns all libraries ordered by name.

func (*Service) Stats

func (s *Service) Stats(ctx context.Context, id string) (Stats, error)

Stats returns runtime metrics for the library.

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Library, error)

Update replaces the mutable fields of an existing library. Returns ErrNotFound if the library does not exist.

type Stats

type Stats struct {
	SeriesCount int64
}

Stats holds runtime metrics about a library.

type UpdateRequest

type UpdateRequest = CreateRequest

UpdateRequest carries the fields needed to update a library. It is identical in shape to CreateRequest.

Jump to

Keyboard shortcuts

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