deps

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package deps manages external dependencies for GPU Go, including downloading and managing vgpu libraries from the CDN.

Index

Constants

View Source
const (
	// DefaultCDNBaseURL is the default CDN for downloading dependencies
	DefaultCDNBaseURL = "https://cdn.tensor-fusion.ai"

	// ManifestPath is the path to the version manifest on CDN
	ManifestPath = "/vgpu/manifest.json"

	// CachedManifestFile is the filename for the cached releases manifest
	CachedManifestFile = "releases-manifest.json"

	// DownloadedManifestFile is the filename for the downloaded dependencies manifest
	DownloadedManifestFile = "downloaded-manifest.json"

	// InstalledManifestFile is the filename for the installed dependencies manifest
	InstalledManifestFile = "deps-manifest.json"

	// AutoSyncInterval is the interval for auto-syncing the manifest
	AutoSyncInterval = 7 * 24 * time.Hour
)
View Source
const (
	LibraryTypeVGPULibrary     = "vgpu-library"
	LibraryTypeRemoteGPUWorker = "remote-gpu-worker"
	LibraryTypeRemoteGPUClient = "remote-gpu-client"
)

Library type constants

Variables

This section is empty.

Functions

func VGPULibraries

func VGPULibraries() []string

VGPULibraries returns the standard vGPU library names for the current platform

Types

type DownloadedManifest

type DownloadedManifest struct {
	UpdatedAt time.Time          `json:"updated_at"`
	Libraries map[string]Library `json:"libraries"` // name -> library
}

DownloadedManifest represents locally downloaded dependencies

type Library

type Library struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Platform string `json:"platform"` // linux, darwin, windows
	Arch     string `json:"arch"`     // amd64, arm64
	URL      string `json:"url"`
	SHA256   string `json:"sha256"`
	Size     int64  `json:"size"`
	Type     string `json:"type,omitempty"` // e.g., "vgpu-library", "remote-gpu-worker", "remote-gpu-client"
	// Vendor information from release
	VendorSlug string `json:"vendorSlug,omitempty"` // e.g., "stub", "nvidia", "amd"
	VendorName string `json:"vendorName,omitempty"` // e.g., "STUB", "NVIDIA", "AMD"
}

Library represents a downloadable library

type LocalManifest

type LocalManifest struct {
	InstalledAt time.Time          `json:"installed_at"`
	Libraries   map[string]Library `json:"libraries"` // name -> library
}

LocalManifest represents locally installed dependencies

type Manager

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

Manager manages dependency downloads and versions

func NewManager

func NewManager(opts ...ManagerOption) *Manager

NewManager creates a new dependency manager

func (*Manager) CheckUpdates

func (m *Manager) CheckUpdates(ctx context.Context) ([]Library, error)

CheckUpdates checks if any installed libraries have updates available

func (*Manager) CleanCache

func (m *Manager) CleanCache() error

CleanCache removes all cached downloads

func (*Manager) DownloadLibrary

func (m *Manager) DownloadLibrary(ctx context.Context, lib Library, progressFn func(downloaded, total int64)) error

DownloadLibrary downloads a library to the cache directory

func (*Manager) FetchManifest

func (m *Manager) FetchManifest(ctx context.Context) (*Manifest, bool, error)

FetchManifest loads the cached manifest, and syncs from API if not available or outdated Returns true as second argument if an auto-sync was performed and updates were found

func (*Manager) GetAllLibraries

func (m *Manager) GetAllLibraries(manifest *Manifest) []Library

GetAllLibraries returns all libraries from the manifest, grouped by platform/arch

func (*Manager) GetDownloadedLibraries

func (m *Manager) GetDownloadedLibraries() (*DownloadedManifest, error)

GetDownloadedLibraries returns the downloaded libraries

func (*Manager) GetInstalledLibraries

func (m *Manager) GetInstalledLibraries() (*LocalManifest, error)

GetInstalledLibraries returns the locally installed libraries

func (*Manager) GetLibrariesForPlatform

func (m *Manager) GetLibrariesForPlatform(manifest *Manifest, osStr, arch, libType string) []Library

GetLibrariesForPlatform returns libraries matching the specified platform and type If both os and arch are empty strings, uses the current platform If only os is provided, matches any arch for that os If only arch is provided, matches any os for that arch If type is empty string, matches any type

func (*Manager) GetLibraryPath

func (m *Manager) GetLibraryPath(name string) string

GetLibraryPath returns the path to an installed library (in cache)

func (*Manager) GetRemoteGPUWorkerPath

func (m *Manager) GetRemoteGPUWorkerPath(ctx context.Context) (string, error)

GetRemoteGPUWorkerPath returns the path to the remote-gpu-worker binary It first checks if already installed, if not downloads it from the API

func (*Manager) InstallLibrary

func (m *Manager) InstallLibrary(lib Library) error

InstallLibrary installs a downloaded library (marks it as installed)

func (*Manager) LoadCachedManifest

func (m *Manager) LoadCachedManifest() (*Manifest, error)

LoadCachedManifest loads the cached manifest from local storage

func (*Manager) SyncReleases

func (m *Manager) SyncReleases(ctx context.Context, osStr, arch string) (*Manifest, error)

SyncReleases fetches releases from the API and caches them locally If os and arch are empty strings, uses the current platform Returns the synced manifest for verbose output

func (*Manager) VerifyLibrary

func (m *Manager) VerifyLibrary(path, expectedHash string) bool

VerifyLibrary checks if a file exists and has the expected hash Returns true if expectedHash is empty (verification skipped)

type ManagerOption

type ManagerOption func(*Manager)

ManagerOption configures the dependency manager

func WithAPIBaseURL

func WithAPIBaseURL(url string) ManagerOption

WithAPIBaseURL sets a custom API base URL

func WithAPIClient

func WithAPIClient(client *api.Client) ManagerOption

WithAPIClient sets a custom API client

func WithCDNBaseURL

func WithCDNBaseURL(url string) ManagerOption

WithCDNBaseURL sets a custom CDN base URL

func WithPaths

func WithPaths(paths *platform.Paths) ManagerOption

WithPaths sets custom paths

type Manifest

type Manifest struct {
	Version   string    `json:"version"`
	UpdatedAt time.Time `json:"updated_at"`
	Libraries []Library `json:"libraries"`
}

Manifest represents the version manifest from CDN

Jump to

Keyboard shortcuts

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