cleanup

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 13 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 cleanup 提供受管可丢弃缓存与临时内容的清理服务。

cleanup 获取 mutation Mutex 后,只通过 filesystem.Operator 的受控删除 能力删除明确授权目标;用户数据、插件目录与诊断日志来自 config 保护名单, 一律不触碰。repo.update-* 只有在事务状态、目录身份与 PID 事实全部匹配 时才允许删除,身份不明时失败关闭。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportDetails

func ReportDetails(report Report) map[string]any

ReportDetails 返回 result.details 使用的非敏感条目清单与计数。

Types

type Error

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

Error 描述 cleanup 服务失败,供 cli 会话框架映射协议四元组。

func NewError

func NewError(
	code protocol.Code,
	stage protocol.Stage,
	message string,
	details map[string]any,
	cause error,
) *Error

NewError 构造 cleanup 服务错误。

func (*Error) Code

func (e *Error) Code() protocol.Code

func (*Error) Details

func (e *Error) Details() map[string]any

func (*Error) Error

func (e *Error) Error() string

func (*Error) Message

func (e *Error) Message() string

func (*Error) Stage

func (e *Error) Stage() protocol.Stage

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Item

type Item struct {
	ID      string
	Status  ItemStatus
	Message string
	Details map[string]any
}

Item 描述一次清理目标的稳定结果。

type ItemStatus

type ItemStatus string

ItemStatus 是单条清理目标的稳定结果。

const (
	ItemCleaned ItemStatus = "cleaned"
	ItemSkipped ItemStatus = "skipped"
	ItemFailed  ItemStatus = "failed"
)

func (ItemStatus) String

func (s ItemStatus) String() string

String 返回 ItemStatus 的稳定字面量。

func (ItemStatus) Valid

func (s ItemStatus) Valid() bool

Valid 报告 ItemStatus 是否属于稳定全集。

type Report

type Report struct {
	Items   []Item
	Summary Summary
}

Report 是 cleanup 的结构化输出,全部字段都不含绝对路径。

type Service

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

Service 组合布局与审计器执行清理。

func New

func New(layout *config.Layout, auditor filesystem.Auditor) (*Service, error)

New 创建清理服务,layout 与 auditor 都不可为空。

func (*Service) Run

func (s *Service) Run(ctx context.Context, emitter *protocol.Emitter) (report Report, err error)

Run 获取 mutation 锁后执行清理计划。 任一条目失败时命令返回 GIT_REPO_CLEANUP_FAILED,details 保留完整副作用报告。

type Summary

type Summary struct {
	Total   int
	Cleaned int
	Skipped int
	Failed  int
}

Summary 汇总一次清理的计数。

Jump to

Keyboard shortcuts

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