OmniStacksStaticModules 2.0.0
Loading...
Searching...
No Matches
ProjectSync Namespace Referenceexport

Namespaces

namespace  anonymous_namespace{ProjectSync.cppm}

Classes

struct  DbPaths
 项目索引数据库路径。 More...
struct  SyncSummary
 同步结果摘要;用于 CLI、Alfred 反馈和接口日志。 More...

Enumerations

enum class  SyncError {
  search_path_missing , search_path_not_directory , project_db_unreadable , project_file_unreadable ,
  io_failure
}
 工作区同步的可恢复错误分类。 More...

Functions

std::expected< SyncSummary, SyncError > sync_all (const std::filesystem::path &search_path, const DbPaths &paths={})
 同步新增路径与全部已记忆路径,并原子重建两个索引。
template<std::invocable< const std::filesystem::directory_entry & > Visitor>
void for_each_project_file (const std::filesystem::path &directory, Visitor &&visitor)
 递归遍历工作区中的 .project 文件。
std::string_view sync_error_message (SyncError error) noexcept
 SyncError 到稳定、可读的 CLI/Alfred 错误文本。
std::string format_file_time (std::filesystem::file_time_type file_time)
 把 filesystem 写入时间转换为本地 YYYY-MM-DD HH:MM:SS。
std::string format_file_time (fs::file_time_type file_time)
std::expected< SyncSummary, SyncError > sync_all (const fs::path &search_path, const DbPaths &paths)

Enumeration Type Documentation

◆ SyncError

enum class ProjectSync::SyncError
exportstrong

工作区同步的可恢复错误分类。

Enumerator
search_path_missing 

新路径不存在。

search_path_not_directory 

新路径是文件而不是目录。

project_db_unreadable 

现有 Project.json 无法解析。

project_file_unreadable 

一个或多个 .project 文件损坏。

io_failure 

目录遍历或索引写入失败。

Definition at line 53 of file ProjectSync.cppm.

Function Documentation

◆ for_each_project_file()

template<std::invocable< const std::filesystem::directory_entry & > Visitor>
void ProjectSync::for_each_project_file ( const std::filesystem::path & directory,
Visitor && visitor )
export

递归遍历工作区中的 .project 文件。

Parameters
directory工作区根目录;不存在或不是目录时直接返回。
visitor接收 directory_entry 的函数对象。
Note
跳过无权限目录;其他迭代错误由调用方后续的文件读取路径兜底。

Definition at line 86 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format_file_time() [1/2]

std::string ProjectSync::format_file_time ( fs::file_time_type file_time)

Definition at line 220 of file ProjectSync.cppm.

Here is the call graph for this function:

◆ format_file_time() [2/2]

std::string ProjectSync::format_file_time ( std::filesystem::file_time_type file_time)
export

把 filesystem 写入时间转换为本地 YYYY-MM-DD HH:MM:SS。

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sync_all() [1/2]

std::expected< SyncSummary, SyncError > ProjectSync::sync_all ( const fs::path & search_path,
const DbPaths & paths )

Definition at line 238 of file ProjectSync.cppm.

Here is the call graph for this function:

◆ sync_all() [2/2]

std::expected< SyncSummary, SyncError > ProjectSync::sync_all ( const std::filesystem::path & search_path,
const DbPaths & paths = {} )
export

同步新增路径与全部已记忆路径,并原子重建两个索引。

Parameters
search_path新增工作区;空路径表示仅重载已保存路径。
pathsProject/Stack 索引路径。
Returns
成功返回统计摘要;失败返回第一个可恢复错误分类。
Note
单文件损坏采用“继续扫描 + 最终返回错误”的部分成功语义。
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sync_error_message()

std::string_view ProjectSync::sync_error_message ( SyncError error)
exportnoexcept

SyncError 到稳定、可读的 CLI/Alfred 错误文本。

Definition at line 402 of file ProjectSync.cppm.

Here is the call graph for this function:
Here is the caller graph for this function: