Documentation
¶
Index ¶
- type ChunkRow
- type DB
- func (db *DB) ClearHostCaps() error
- func (db *DB) Close() error
- func (db *DB) DeleteChunks(url, dest string) error
- func (db *DB) DeleteChunksTx(tx *sql.Tx, url, dest string) error
- func (db *DB) DeleteDownload(url, dest string) error
- func (db *DB) DeleteHostCaps(host string) error
- func (db *DB) DeleteMetadata(downloadURL string) error
- func (db *DB) GetHostCaps(host string) (HostCaps, bool, error)
- func (db *DB) GetMetadata(downloadURL string) (*ModelMetadata, error)
- func (db *DB) GetMetadataByDest(dest string) (*ModelMetadata, error)
- func (db *DB) IncDownloadRetries(url, dest string, delta int64) error
- func (db *DB) InitChunksTable() error
- func (db *DB) InitHostCapsTable() error
- func (db *DB) InitMetadataTable() error
- func (db *DB) ListChunks(url, dest string) ([]ChunkRow, error)
- func (db *DB) ListDownloads() ([]DownloadRow, error)
- func (db *DB) ListHostCaps() ([]HostCaps, error)
- func (db *DB) ListMetadata(filters MetadataFilters) ([]ModelMetadata, error)
- func (db *DB) SearchMetadata(query string) ([]ModelMetadata, error)
- func (db *DB) UpdateChunkSHA(url, dest string, idx int, sha string) error
- func (db *DB) UpdateChunkSHATx(tx *sql.Tx, url, dest string, idx int, sha string) error
- func (db *DB) UpdateChunkStatus(url, dest string, idx int, status string) error
- func (db *DB) UpdateChunkStatusTx(tx *sql.Tx, url, dest string, idx int, status string) error
- func (db *DB) UpdateDownloadStatus(url, dest, status, lastError string) error
- func (db *DB) UpdateMetadataUsage(downloadURL string) error
- func (db *DB) UpsertChunk(c ChunkRow) error
- func (db *DB) UpsertChunkTx(tx *sql.Tx, c ChunkRow) error
- func (db *DB) UpsertDownload(row DownloadRow) error
- func (db *DB) UpsertHostCaps(host string, headOK, acceptRanges bool) error
- func (db *DB) UpsertMetadata(meta *ModelMetadata) error
- func (db *DB) WithTx(fn func(tx *sql.Tx) error) error
- type DownloadRow
- type HostCaps
- type MetadataFilters
- type ModelMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
func (*DB) ClearHostCaps ¶
ClearHostCaps deletes all host capabilities from the cache.
func (*DB) DeleteChunks ¶
DeleteChunks removes all chunk rows for a given url+dest pair.
func (*DB) DeleteDownload ¶
DeleteDownload removes a download row for the given url+dest.
func (*DB) DeleteHostCaps ¶
DeleteHostCaps deletes a single host from the cache.
func (*DB) DeleteMetadata ¶ added in v0.6.1
DeleteMetadata removes metadata for a specific download URL
func (*DB) GetMetadata ¶ added in v0.6.1
func (db *DB) GetMetadata(downloadURL string) (*ModelMetadata, error)
GetMetadata retrieves metadata for a specific download URL
func (*DB) GetMetadataByDest ¶ added in v0.6.1
func (db *DB) GetMetadataByDest(dest string) (*ModelMetadata, error)
GetMetadataByDest retrieves metadata for a specific destination path This is optimized with an index for fast lookups by file path
func (*DB) IncDownloadRetries ¶
IncDownloadRetries increments the retries counter for a download row.
func (*DB) InitChunksTable ¶
func (*DB) InitHostCapsTable ¶
func (*DB) InitMetadataTable ¶ added in v0.6.1
InitMetadataTable creates the model_metadata table
func (*DB) ListDownloads ¶
func (db *DB) ListDownloads() ([]DownloadRow, error)
ListDownloads returns a snapshot of the downloads table
func (*DB) ListHostCaps ¶
ListHostCaps returns all cached host capabilities.
func (*DB) ListMetadata ¶ added in v0.6.1
func (db *DB) ListMetadata(filters MetadataFilters) ([]ModelMetadata, error)
ListMetadata retrieves metadata with optional filters
func (*DB) SearchMetadata ¶ added in v0.6.1
func (db *DB) SearchMetadata(query string) ([]ModelMetadata, error)
SearchMetadata performs a full-text search across model metadata
func (*DB) UpdateChunkSHA ¶
func (*DB) UpdateChunkSHATx ¶
func (*DB) UpdateChunkStatus ¶
func (*DB) UpdateChunkStatusTx ¶
func (*DB) UpdateDownloadStatus ¶
UpdateDownloadStatus updates only status and last_error, preserving other fields.
func (*DB) UpdateMetadataUsage ¶ added in v0.6.1
UpdateMetadataUsage increments usage stats and updates last_used timestamp
func (*DB) UpsertChunk ¶
func (*DB) UpsertChunkTx ¶
Tx variants for grouping operations atomically
func (*DB) UpsertDownload ¶
func (db *DB) UpsertDownload(row DownloadRow) error
func (*DB) UpsertHostCaps ¶
func (*DB) UpsertMetadata ¶ added in v0.6.1
func (db *DB) UpsertMetadata(meta *ModelMetadata) error
UpsertMetadata inserts or updates model metadata
type DownloadRow ¶
type MetadataFilters ¶ added in v0.6.1
type MetadataFilters struct {
Source string // Filter by source: "huggingface", "civitai", etc.
ModelType string // Filter by type: "LLM", "LoRA", "Checkpoint", etc.
Favorite bool // Show only favorites
MinRating int // Minimum user rating (1-5)
Tags []string // Filter by tags
OrderBy string // "last_used", "name", "size", "rating", "created_at"
Limit int // Limit results
}
MetadataFilters provides filtering options for ListMetadata
type ModelMetadata ¶ added in v0.6.1
type ModelMetadata struct {
ID int64 `json:"id"`
// Link to downloads table
DownloadURL string `json:"download_url"`
Dest string `json:"dest,omitempty"` // Destination file path
// Basic model info
ModelName string `json:"model_name,omitempty"`
ModelID string `json:"model_id,omitempty"` // e.g., "TheBloke/Llama-2-7B-GGUF"
Version string `json:"version,omitempty"` // e.g., "Q4_K_M", "fp16"
Source string `json:"source,omitempty"` // "huggingface", "civitai", "direct"
// Metadata
Description string `json:"description,omitempty"`
Author string `json:"author,omitempty"`
AuthorURL string `json:"author_url,omitempty"`
License string `json:"license,omitempty"`
Tags []string `json:"tags,omitempty"`
// Model specs
ModelType string `json:"model_type,omitempty"` // "LLM", "LoRA", "Checkpoint", "VAE", "Embedding"
BaseModel string `json:"base_model,omitempty"` // "llama-2", "sdxl", etc.
Architecture string `json:"architecture,omitempty"` // "transformer", "unet", etc.
ParameterCount string `json:"parameter_count,omitempty"` // "7B", "13B", "70B"
Quantization string `json:"quantization,omitempty"` // "Q4_K_M", "Q5_K_S", "fp16"
// File info
FileSize int64 `json:"file_size,omitempty"`
FileFormat string `json:"file_format,omitempty"` // "gguf", "safetensors", "ckpt", "bin"
// Usage stats
DownloadCount int `json:"download_count"`
LastUsed *time.Time `json:"last_used,omitempty"`
TimesUsed int `json:"times_used"`
// External links
HomepageURL string `json:"homepage_url,omitempty"`
RepoURL string `json:"repo_url,omitempty"`
DocumentationURL string `json:"documentation_url,omitempty"`
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// Timestamps
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// User data
UserNotes string `json:"user_notes,omitempty"`
UserRating int `json:"user_rating,omitempty"` // 1-5 stars
Favorite bool `json:"favorite"`
}
ModelMetadata stores rich metadata about downloaded models