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 | |||
private.rs | |||
remote.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, and the canonical form of a model file path.
- pids 🔒
- PID file directory path resolution.
- platform 🔒
- Platform-specific path detection and resolution.
- private 🔒
- Directories and files that nobody else on this machine can read.
- remote 🔒
- Where the remote tunnel’s stored endpoint key lives.
- 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§
- canonical_
model_ path - Resolve
pathto the one form the library identifies a model file by. - canonical_
model_ path_ string - The canonical path as the string the
file_pathcolumn stores. - create_
private_ dir - Create
dirand any parents it lacks0700, and take group and other’s access away from adirthat was already there. - create_
private_ file - Create
fileempty and0600, or take group and other’s access away from one that is already there. - 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.
- 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.
- make_
private - Take group and other’s access away from whatever is at
path; the owner keeps what it had. - persist_
models_ dir - Persist the selected models directory into
.env. - pids_
dir - Returns the directory where PID files are stored.
- remote_
identity_ path - Path to the stored iroh endpoint key for the remote tunnel.
- 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.