Documentation
¶
Overview ¶
Package interfaces holds shared contracts consumed by both the server orchestrator (App) and the handlers package. These interfaces live here to avoid circular dependencies while keeping the contracts in a neutral, stable location.
Package interfaces holds shared contracts consumed by both the server orchestrator (App) and the handlers package. These interfaces live here to avoid circular dependencies while keeping the contracts in a neutral, stable location.
Package interfaces holds shared contracts consumed by both the server orchestrator (App) and the handlers package. These interfaces live here to avoid circular dependencies while keeping the contracts in a neutral, stable location.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerQueries ¶
type HandlerQueries interface {
GetFolderViewByID(ctx context.Context, id int64) (gallerydb.FolderView, error)
GetFoldersViewsByParentIDOrderByName(ctx context.Context, parent sql.NullInt64) ([]gallerydb.FolderView, error)
GetFileViewsByFolderIDOrderByFileName(ctx context.Context, folderID sql.NullInt64) ([]gallerydb.FileView, error)
GetFileViewByID(ctx context.Context, id int64) (gallerydb.FileView, error)
GetFolderByID(ctx context.Context, id int64) (gallerydb.Folder, error)
GetThumbnailsByFileID(ctx context.Context, fileID int64) (gallerydb.Thumbnail, error)
GetThumbnailBlobDataByID(ctx context.Context, id int64) ([]byte, error)
// GetPreloadRoutesByFolderID returns routes to preload for a folder (source of truth: direct children only).
// Returns *sql.Rows; each row contains a route string to scan.
GetPreloadRoutesByFolderID(ctx context.Context, parentID sql.NullInt64) (*sql.Rows, error)
// GetGalleryStatistics returns aggregate statistics about the gallery (folder count, file count, total size, timestamps).
GetGalleryStatistics(ctx context.Context) (gallerydb.GetGalleryStatisticsRow, error)
}
HandlerQueries abstracts the subset of DB queries used by HTTP handlers. Shared by server and handlers packages.
type MetadataQueries ¶ added in v0.8.0
type MetadataQueries interface {
GetExifByFile(ctx context.Context, fileID int64) (gallerydb.ExifMetadatum, error)
GetIPTCByFile(ctx context.Context, fileID int64) (gallerydb.IptcMetadatum, error)
}
MetadataQueries abstracts EXIF and IPTC reads for a file. Used by GalleryHandlers (InfoBoxImage).
type ServerDeps ¶ added in v0.8.0
type ServerDeps interface {
// --- Credential operations ---
CheckAccountLockout(ctx context.Context, username string) (bool, error)
GetUser(ctx context.Context, username string) (*session.User, error)
RecordFailedLoginAttempt(ctx context.Context, username string) error
ClearLoginAttempts(ctx context.Context, username string) error
UpdateUsername(ctx context.Context, username string) error
UpdatePassword(ctx context.Context, passwordHash string) error
// --- Config operations ---
UpdateConfigWithPrecedence(cfg *config.Config, changedFields []string)
ApplyConfig()
InvalidateHTTPCache()
SetPreloadEnabled(enabled bool)
SetRestartRequired(b bool)
TriggerRestart()
// --- Gallery queries ---
GetHandlerQueries(cpc *dbconnpool.CpConn) HandlerQueries
GetMetadataQueries(cpc *dbconnpool.CpConn) MetadataQueries
GetConfigQueries(cpc *dbconnpool.CpConn) config.ConfigQueries
GetETagVersion() string
ImagesDir() string
// --- Server control ---
Shutdown()
TriggerDiscovery()
ResetStats()
StartCacheBatchLoad() (StartCacheBatchLoadResult, error)
// --- Config access ---
GetConfig() *config.Config
// --- Template helpers ---
AddCommonTemplateData(w http.ResponseWriter, r *http.Request, data map[string]any, fullPage bool) map[string]any
ServerError(w http.ResponseWriter, r *http.Request, err error)
}
ServerDeps provides all server-level dependencies consumed by handler groups. Implemented by *server.App, it replaces the previous callback-field wiring pattern with a single compile-time-checked interface.
type StartCacheBatchLoadResult ¶ added in v0.8.0
type StartCacheBatchLoadResult struct {
Blocked bool // true if discovery is active
Message string // toast message
}
StartCacheBatchLoadResult describes the result of attempting to start cache batch load.