sqlite

package
v0.0.0-...-9b56d49 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Client *sql.DB
}

Database is a wrapper around the database driver client

func NewDatabase

func NewDatabase(configDir string, logger controller.Logger) (Database, error)

NewDatabase returns an instantiated SQLiteDatabase.

type FileCacheAdapter

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

FileCacheAdapter satisfies the controller.FilesCacheDataStorer interface by turning interface requests into SQL requests that are passed on to an underlying SQLiteDatabase.

func NewFileCacheAdapter

func NewFileCacheAdapter(db *Database) FileCacheAdapter

NewFileCacheAdapter returns an instantiated FileCacheAdapter.

func (*FileCacheAdapter) Metadata

func (a *FileCacheAdapter) Metadata(path string) (controller.FileMetadata, error)

Metadata uses a SQL SELECT statement to obtain the metadata associated with the provided path.

func (*FileCacheAdapter) Modtime

func (a *FileCacheAdapter) Modtime(path string) (time.Time, error)

Modtime uses a SQL SELECT statement to obtain the modtime associated with the provided path.

func (*FileCacheAdapter) SaveMetadata

func (a *FileCacheAdapter) SaveMetadata(path string, f controller.FileMetadata) error

SaveMetadata uses the UPSERT syntax to update the metadata that is associated with the provided path in the database.

func (*FileCacheAdapter) SaveModtime

func (a *FileCacheAdapter) SaveModtime(path string, t time.Time) error

SaveModtime uses the UPSERT syntax to update the modtime that is associated with the provided path in the database.

type HealthCheckerAdapter

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

HealthCheckerAdapter satisfies the controller.HealthCheckerDataStorer interface by turning interface requests into SQL requests that are passed on to an underlying SQLiteDatabase.

func NewHealthCheckerAdapter

func NewHealthCheckerAdapter(db *Database, logger controller.Logger) HealthCheckerAdapter

NewHealthCheckerAdapter returns a new instantiated HealthCheckerAdapter.

func (*HealthCheckerAdapter) DeleteJob

func (h *HealthCheckerAdapter) DeleteJob(uuid controller.UUID) error

DeleteJob deletes a specific job from the database.

func (*HealthCheckerAdapter) DispatchedJobs

func (h *HealthCheckerAdapter) DispatchedJobs() []controller.DispatchedJob

DispatchedJobs returns all of the dispatched jobs in the database.

type LibraryManagerAdapter

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

LibraryManagerAdapter is a struct that satisfies the interface that connects a LibraryManager to a storage medium.

func NewLibraryManagerAdapter

func NewLibraryManagerAdapter(db *Database, logger controller.Logger) LibraryManagerAdapter

NewLibraryManagerAdapter returns an instantiated LibraryManagerAdapter

func (*LibraryManagerAdapter) IsPathDispatched

func (l *LibraryManagerAdapter) IsPathDispatched(path string) (bool, error)

IsPathDispatched loops through the dispatched_jobs table to determine if any jobs with the provided path have already been dispatched.

func (*LibraryManagerAdapter) Libraries

func (l *LibraryManagerAdapter) Libraries() ([]controller.Library, error)

Libraries returns all of the libraries available in the database.

func (*LibraryManagerAdapter) Library

func (l *LibraryManagerAdapter) Library(id int) (controller.Library, error)

Library returns a specific library in the database.

func (*LibraryManagerAdapter) PopDispatchedJob

func (l *LibraryManagerAdapter) PopDispatchedJob(uuid controller.UUID) (controller.DispatchedJob, error)

PopDispatchedJob returns a specific dispatched job and removes it from the database.

func (*LibraryManagerAdapter) PushHistory

func (l *LibraryManagerAdapter) PushHistory(h controller.History) error

PushHistory adds an entry to the history table.

func (*LibraryManagerAdapter) SaveLibrary

func (l *LibraryManagerAdapter) SaveLibrary(lib controller.Library) error

SaveLibrary puts the provided controller.Library into the database.

type RunnerCommunicatorAdapter

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

RunnerCommunicatorAdapter is a struct that satisfies the interface that connects a RunnerCommunicator to a storage medium.

func NewRunnerCommunicatorAdapter

func NewRunnerCommunicatorAdapter(db *Database, logger controller.Logger) RunnerCommunicatorAdapter

NewRunnerCommunicatorAdapter returns an instantiated RunnerCommunicatorAdapter.

func (*RunnerCommunicatorAdapter) DispatchedJob

DispatchedJob uses the provided uuid to retrieve a dispatched job from the database.

func (*RunnerCommunicatorAdapter) SaveDispatchedJob

func (r *RunnerCommunicatorAdapter) SaveDispatchedJob(dJob controller.DispatchedJob) error

SaveDispatchedJob saves the provided dispatched job to the database.

type UserInterfacerAdapter

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

UserInterfacerAdapter is a struct that satisfies the interface that connects a UserInterfacer to a storage medium.

func NewUserInterfacerAdapter

func NewUserInterfacerAdapter(db *Database, logger controller.Logger) UserInterfacerAdapter

NewUserInterfacerAdapter returns an instantiated UserInterfacerAdapter.

func (*UserInterfacerAdapter) DeleteLibrary

func (u *UserInterfacerAdapter) DeleteLibrary(id int) error

DeleteLibrary deletes the specified library from the libraries table.

func (*UserInterfacerAdapter) DispatchedJobs

func (u *UserInterfacerAdapter) DispatchedJobs() ([]controller.DispatchedJob, error)

DispatchedJobs returns the content of the dispatched jobs table.

func (*UserInterfacerAdapter) HistoryEntries

func (u *UserInterfacerAdapter) HistoryEntries() ([]controller.History, error)

HistoryEntries returns the content of the history table.

Jump to

Keyboard shortcuts

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