____ _
/ ___| __ _| |___ __ _
\___ \ / _` | / __|/ _` |
___) | (_| | \__ \ (_| |
|____/ \__,_|_|___/\__,_|
萨尔萨摘要逻辑服务资产
salsa 是Chris界面生态系统的逻辑层. 它囊括了高层次的业务意向和业务逻辑,充当了用户-界面之间的桥梁(Cchell, (中文(简体) ), chili基本基础设施cumin 财务报告和审定财务报表 chrisapi) (中文(简体) ).
安装
npm install @fnndsc/salsa
要求节点.js 20.12. 有"类型"(TypeScript)类型定义的船舶. 取决于 @fnndsc/cumin。 。 。 .
使用量
import { files_listAll, fileContent_get, vfsDispatcher } from "@fnndsc/salsa";
// Salsa returns pure data / typed objects — no CLI dependencies
const listing = await files_listAll({ limit: 1000, offset: 0 }, "files", "/home/chris");
const content = await fileContent_get("/home/chris/uploads/notes.txt");
见 关键模块 整个意图目录.
目的
- 合并业务逻辑: 集中意图如"列表目录","上载文件","注册插件","fetch feed note"等. 所有前端都有相同的行为.
- 前端不可知论: 不存在针对特定国家综合倡议的依赖性(
commander, (中文(简体) ),process.stdout) (中文(简体) ). 返回纯数据或输入对象. - 虚拟文件系统: 拥有将 ChRIS API 资源映射到 Unix 风格路径的 VFS 调度器 — 见 VFS 飞行器 见下文.
结构:桑威奇模型
[ ChELL (REPL) ] [ Chili (CLI) ] [ Web App ] [ Mobile App ]
| | | |
+-----------------+---------------+ |
| |
v v
[ Salsa (Logic / Intents) ] <-- YOU ARE HERE
|
v
[ Cumin (State / Infrastructure) ]
|
v
[ @fnndsc/chrisapi (Client) ]
关键模块
文件系统
| 函数 | 说明 |
|---|---|
vfsDispatcher | 路线 list编号 :read 通过路径前缀调用正确的 VFS 提供者 |
files_list | 列出目录( 贴上) |
files_listAll | 完整目录列表( 所有页面) |
fileContent_get | 读取远程文件内容 |
files_uploadPath | 上传本地文件或目录树到 Chris |
files_touch | 创建空文件 |
files_mkdir | 创建目录 |
files_rm | 删除文件或目录 |
files_cp 编号 : files_mv | 复制/ 移动 |
插件存储( S)
| 函数 | 说明 |
|---|---|
plugins_list 编号 : plugins_listAll | 获取插件列表 |
plugin_checkExists | 检查插件是否已注册 |
plugin_registerWithAdmin | 通过管理端点注册插件 |
plugin_assignToComputeResources | 指定用于计算环境的插件 |
plugins_searchPeers | 搜索对等的 Chris 商店( 如 cube.chrisproject.org) |
plugin_importFromStore | 从对等存储数据导入插件 |
plugin_searchPeersByImage | 将嵌入到对等存储插件中 |
种子和子资源
| 函数 | 说明 |
|---|---|
feeds_list 编号 : feeds_listAll | 获取种子 |
feedNote_get 编号 : feedNote_update | 读取或更新种子上的单通音符 |
feedComments_list | 列出种子上的评论 |
feedComment_create 编号 : feedComment_update 编号 : feedComment_delete | 注释 CRUD |
管道和工作流量
| 函数 | 说明 |
|---|---|
pipelines_list | 登记管道清单 |
workflow_create | 将管道作为饲料的工作流程 |
工作(意外事故操作)
| 函数 | 说明 |
|---|---|
job_cancel(id) | 取消运行/计划实例( E)PUT {status: cancelled}(中文(简体) ) |
job_delete(id) | 删除终端实例记录 |
job_statusFetch(id) | 从 API (通过缓存) 的活捉当前状态 |
job_logFetch(id) | 获取实例的 stdout/ stderr 日志 |
procCache_refresh([feedID]) | 重建 /proc 任务缓存, 可选范围到一个种子 |
虚拟文件系统( VFS)
vfsDispatcher 将 ChRIS 路径翻译为提供者调用 。 每个提供者处理路径前缀,并将 API 资源映射到文件系统语义上 :
| 路径前缀 | 提供者 | 后卫 |
|---|---|---|
/home/<user>/ | HomeVfsProvider | ChRIS 用户文件 API |
/home/<user>/feeds/ | FeedVfsProvider | 饲料资源 |
/bin | BinVfsProvider | 注册的插件( 虚拟可执行文件) |
/usr/bin | UsrBinVfsProvider | 内建 shell 命令 (whoami, (中文(简体) ), whereami(中文(简体) ) |
/etc | EtcVfsProvider | 配置文件( E)compute.yaml, (中文(简体) ), group, (中文(简体) ), passwd, (中文(简体) ), cube(中文(简体) ) |
/net/pacs/queries/ | PacsVfsProvider | PACS 查询结果 |
/proc/jobs/ | ProcVfsProvider | 工作监测DAG(由 ProcCache (单位:千兆克) |
*.chrislink | 通过调度器解决 | 与其他 ChRIS 路径的协同 |
供应商实施共同接口: list(path) → Result<VFSItem[]> 财务报告和审定财务报表 read(path) → Result<string>。 。 。 .
/proc/jobs/ - 工作监测
ProcVfsProvider 镜像每个可见种子的计算 DAG 。 每个插件实例都是目录;内部的虚拟文件会显示活状态,参数和日志:
/proc/jobs/feed_123/
├── status ← aggregate: running | finishedSuccessfully | finishedWithError
├── title
└── pl-dircopy_456/ ← type=job in VFSItem; ls -l shows colour-coded status
├── status ← live API fetch if non-terminal
├── params ← complete effective key=value run parameters, cached permanently
├── log ← never cached; decoded from CUBE's `raw` response
└── pl-fshack_789/
└── …
缓存( T)ProcCache o(1)检索和O(深入)路径重建的平地地形图。 守护进程从一个身份扫描的局部检查点恢复了这个已恢复正常的图表,验证了可见的种子,然后只调和了新的,已更改的和活性的种子; proc refresh 明确运行相接的 CUBE 全球扫描。 终极状态继续存在;现役状态仍然有效。 新鲜是访问驱动的:重温一个种子会合并上次访问以来创建或完成的节点(min_end_date 从每只食用光标上),并重新检查活性光标,一个固定的种子最多每10分钟重新检查一次,a /proc/jobs 访问比已知最高的id(一旦名册上有10分钟时间. params 读取完整 PluginInstance.parameters 收集,而不是实例详细元数据。 日志仍为未刻录:ChELL解码 CUBE 的 Base64/zlib-compressed PluginInstance.raw 回复和读取 compute.logs它从不从演讲中获取.
发展
构建
npm run build
测试
npm run test
许可证
麻省理工学院—— Chris项目。 。 。 .
- 30岁