config

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config 统一管理 Runtime 配置与受管目录布局。

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyPath 表示必需路径为空。
	ErrEmptyPath = errors.New("path is empty")
	// ErrPathContainsNUL 表示路径包含 NUL。
	ErrPathContainsNUL = errors.New("path contains nul")
	// ErrBaseNotAbsolute 表示显式 base 不是绝对路径。
	ErrBaseNotAbsolute = errors.New("base path is not absolute")
	// ErrInvalidPath 表示路径形式无法安全解析。
	ErrInvalidPath = errors.New("path is invalid")
	// ErrAppRootIsRoot 表示 app root 指向卷根。
	ErrAppRootIsRoot = errors.New("app root is a volume root")
	// ErrInvalidSegment 表示动态文件名 segment 非法。
	ErrInvalidSegment = errors.New("path segment is invalid")
	// ErrInvalidLogDate 表示日志日期为零值。
	ErrInvalidLogDate = errors.New("log date is invalid")
)

Functions

func PythonExecutableInVenv added in v0.1.17

func PythonExecutableInVenv(venvDir string) string

PythonExecutableInVenv 返回指定 Windows 虚拟环境的解释器路径。

Types

type Layout

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

Layout 保存一个 app root 的不可变受管目录布局。

func NewLayout

func NewLayout(appRoot, base string) (*Layout, error)

NewLayout 以显式绝对 base 解析 app root,不访问文件系统。

func (*Layout) AppRoot

func (l *Layout) AppRoot() string

AppRoot 返回规范化的显示与文件 I/O 路径。

func (*Layout) BackendEntryFile

func (l *Layout) BackendEntryFile() string

BackendEntryFile 返回受管后端入口文件路径。

func (*Layout) BackendStateFile

func (l *Layout) BackendStateFile() string

BackendStateFile 返回后端状态文件路径。

func (*Layout) BuildCacheDir

func (l *Layout) BuildCacheDir() string

BuildCacheDir 返回构建缓存目录。

func (*Layout) ConfigDir

func (l *Layout) ConfigDir() string

ConfigDir 返回用户配置目录。

func (*Layout) DataDir

func (l *Layout) DataDir() string

DataDir 返回用户数据目录。

func (*Layout) DebugDir

func (l *Layout) DebugDir() string

DebugDir 返回诊断数据目录。

func (*Layout) DependencySyncDir

func (l *Layout) DependencySyncDir(operationID string) (string, error)

DependencySyncDir 返回一次依赖同步中改写锁副本使用的临时项目目录。

该目录位于构建缓存下,属于可丢弃缓存:由 Runtime 在每次镜像尝试前创建、 尝试结束后立即删除,绝不落在 repo 或任何用户数据目录里。

func (*Layout) DownloadCacheDir

func (l *Layout) DownloadCacheDir() string

DownloadCacheDir 返回下载缓存目录。

func (*Layout) DownloadFile

func (l *Layout) DownloadFile(name string) (string, error)

DownloadFile 返回下载缓存中指定文件的路径。

func (*Layout) DownloadPartFile

func (l *Layout) DownloadPartFile(name string) (string, error)

DownloadPartFile 返回下载缓存中指定文件的分段下载路径。

func (*Layout) EnvironmentStateFile

func (l *Layout) EnvironmentStateFile() string

EnvironmentStateFile 返回环境状态文件路径。

func (*Layout) HistoryDir

func (l *Layout) HistoryDir() string

HistoryDir 返回历史记录目录。

func (*Layout) IdentityKey

func (l *Layout) IdentityKey() string

IdentityKey 返回大小写不敏感的词法身份键。

func (*Layout) LogsDir

func (l *Layout) LogsDir() string

LogsDir 返回日志根目录。

func (*Layout) MutationStateFile

func (l *Layout) MutationStateFile() string

MutationStateFile 返回变更事务状态文件路径。

func (*Layout) PluginsDir

func (l *Layout) PluginsDir() string

PluginsDir 返回插件目录。

func (*Layout) ProtectedRootDirs

func (l *Layout) ProtectedRootDirs() []string

ProtectedRootDirs 返回自动流程不得删除或移动的根级目录。

func (*Layout) PyProjectFile

func (l *Layout) PyProjectFile() string

PyProjectFile 返回受管仓库的项目元数据路径。

func (*Layout) PythonDir

func (l *Layout) PythonDir() string

PythonDir 返回受管 Python 目录。

func (*Layout) PythonExecutable

func (l *Layout) PythonExecutable() string

PythonExecutable 返回受管 Python 解释器路径。 消费方不得自行拼接 PythonDir() 与文件名:路径知识只能来自本包(AGENTS §4)。

func (*Layout) PythonVersionFile

func (l *Layout) PythonVersionFile() string

PythonVersionFile 返回受管仓库的精确 Python 版本文件路径。

func (*Layout) RelayStagingDir added in v0.1.7

func (l *Layout) RelayStagingDir() string

RelayStagingDir 返回回环中继的暂存目录。

它位于下载缓存之下,属于可丢弃缓存:中继在操作期间独占、Close 时清空, cleanup 随 DownloadCacheDir 一并删除,不需要单独分类。

func (*Layout) RepoDir

func (l *Layout) RepoDir() string

RepoDir 返回受管后端仓库目录。

func (*Layout) RepoPreviousDir

func (l *Layout) RepoPreviousDir(operationID string) (string, error)

RepoPreviousDir 返回本次仓库替换前的保留目录。

func (*Layout) RepoUpdateDir

func (l *Layout) RepoUpdateDir(operationID string) (string, error)

RepoUpdateDir 返回本次仓库更新操作的暂存目录。

func (*Layout) RepoVersionFile

func (l *Layout) RepoVersionFile() string

RepoVersionFile 返回受管仓库版本文件路径。

func (*Layout) RuntimeCacheDir

func (l *Layout) RuntimeCacheDir() string

RuntimeCacheDir 返回 Runtime 缓存根目录。

func (*Layout) RuntimeDir

func (l *Layout) RuntimeDir() string

RuntimeDir 返回 Runtime 受管运行目录。

func (*Layout) RuntimeLogDir

func (l *Layout) RuntimeLogDir() string

RuntimeLogDir 返回 Runtime 日志目录。

func (*Layout) RuntimeLogFile

func (l *Layout) RuntimeLogFile(command string, localDate time.Time) (string, error)

RuntimeLogFile 返回指定命令在本地日期的运行日志文件路径。

func (*Layout) ScriptDir

func (l *Layout) ScriptDir() string

ScriptDir 返回外部脚本目录。

func (*Layout) StateDir

func (l *Layout) StateDir() string

StateDir 返回 Runtime 状态文件目录。

func (*Layout) UVCacheDir

func (l *Layout) UVCacheDir() string

UVCacheDir 返回 uv 缓存目录。

func (*Layout) UVExecutable

func (l *Layout) UVExecutable(version string) (string, error)

UVExecutable 返回指定 uv 版本的可执行文件路径。

func (*Layout) UVLockFile

func (l *Layout) UVLockFile() string

UVLockFile 返回受管仓库的锁文件路径。

func (*Layout) UVStagingDir

func (l *Layout) UVStagingDir(version, operationID string) (string, error)

UVStagingDir 返回指定 uv 版本与操作的构建暂存目录。

func (*Layout) UVToolsDir

func (l *Layout) UVToolsDir() string

UVToolsDir 返回受管 uv 工具目录。

func (*Layout) UVVersionDir

func (l *Layout) UVVersionDir(version string) (string, error)

UVVersionDir 返回指定 uv 版本的工具目录。

func (*Layout) UpdateStateFile

func (l *Layout) UpdateStateFile() string

UpdateStateFile 返回更新状态文件路径。

func (*Layout) VenvConfigFile added in v0.1.5

func (l *Layout) VenvConfigFile() string

VenvConfigFile 返回受管项目虚拟环境的 pyvenv.cfg 路径。 CPython 靠它算出 venv 的 home 与 base 解释器:文件缺失时 venv 内的 python.exe 仍在,但一启动就以 `No pyvenv.cfg file` 退出,因此它是判断 venv 是否完整的必检项。

func (*Layout) VenvDir

func (l *Layout) VenvDir() string

VenvDir 返回受管 Python 虚拟环境目录。

func (*Layout) VenvPythonExecutable

func (l *Layout) VenvPythonExecutable() string

VenvPythonExecutable 返回受管项目虚拟环境的 Python 解释器路径。

Jump to

Keyboard shortcuts

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