Expand description
Β§paths
Path utilities for gglib data directories and user-configurable locations.
This module provides the canonical path resolution for all gglib components:
- Database location
- Models directory
- Llama.cpp binaries
- Application data and resource roots
Β§Design
- Returns
PathBufandPathErrorfor clear error handling - No interactive/terminal I/O - adapters handle user prompts separately
- OS-specific logic is kept private in
platform
Modules
| Module | LOC | Complexity | Coverage |
|---|---|---|---|
config.rs | |||
database.rs | |||
ensure.rs | |||
error.rs | |||
llama.rs | |||
models.rs | |||
pids.rs | |||
platform.rs | |||
resolver.rs | |||
slots.rs | |||
test_utils.rs |
ModulesΒ§
- config π
- Configuration file utilities.
- database π
- Database path resolution.
- ensure π
- Directory creation and verification utilities.
- error π
- Path-related error types.
- llama π
- Llama.cpp binary path resolution.
- models π
- Models directory resolution.
- pids π
- PID file directory path resolution.
- platform π
- Platform-specific path detection and resolution.
- resolver π
- Pure path resolver for testing and CLI introspection.
- slots π
- Slot cache path helpers.
StructsΒ§
- Models
DirResolution - Resolution result for the models directory.
- Resolved
Paths - All resolved paths captured in a single struct.
EnumsΒ§
- Directory
Creation Strategy - Strategy for how to handle missing directories when ensuring they exist.
- Models
DirSource - How the models directory was derived.
- Path
Error - Errors that can occur during path resolution and directory operations.
ConstantsΒ§
- DEFAULT_
MODELS_ DIR_ RELATIVE - Default relative location for downloaded models on non-Windows platforms.
FunctionsΒ§
- data_
root - Get the root directory for application data (database, config).
- database_
path - Get the path to the gglib database file.
- default_
models_ dir - Return the platform-specific default models directory.
- ensure_
directory - Ensure the provided directory exists and is writable according to the chosen strategy.
- env_
file_ path - Location of the
.envfile that stores user overrides. - gglib_
data_ dir - Get the gglib data directory containing llama binaries.
- is_
prebuilt_ binary - Check if we are running from a pre-built binary (not from the source repo).
- llama_
bench_ path - Get the path to the managed
llama-benchbinary. - llama_
config_ path - Get the path to the llama build configuration file.
- llama_
cpp_ dir - Get the path to the llama.cpp repository directory.
- llama_
server_ path - Get the path to the managed llama-server binary.
- persist_
env_ value - Persist a key=value pair into the
.envfile. - persist_
models_ dir - Persist the selected models directory into
.env. - pids_
dir - Returns the directory where PID files are stored.
- resolve_
models_ dir - Resolve the models directory from an explicit override, env var, or default.
- resource_
root - Get the root directory for application resources (binaries, static assets).
- slot_
bin_ path - Full on-disk path for a model+session slot cache file (flat under
slot_dir). - slot_
file_ name - Filename for a model+session slot cache file:
{model_id}__{session_id}.bin. - slot_
model_ prefix - Filename prefix identifying all of one modelβs slot files:
{model_id}__. - slot_
session_ from_ stem - Recover the session id from a slot file stem (
{model_id}__{session}). - slot_
tmp_ file_ name - Filename for an in-flight save:
{model_id}__{session_id}.{nonce}.tmp. - verify_
writable - Verify a directory is writable by attempting to create a test file.