折叠
所有用于freqhole世界的媒体blob存储应用程序:内容地址为blob商店
(sqlite-native and indexeddb/opfs-browser), roh-blops 包装(fs商店生命周期,gc)
保护、经核实的转移、抢夺引擎(主动的blob复制)、确保
协议( 设置一个对等点来设置 blob) , blob acl gating, 媒体帮助器和共享浏览器
乌提尔斯。 生锈的箱子 reliquary + npm 软件包 @freqhole/reliquary。 。 。 .
结构
blake3是各地唯一的犬科内容地址. iroh p2p是一种运输,而不是 架构 - 储存合同和转移流由运输注入。 这个图书馆 从未拥有 http 服务器: 服务范围保留在耗用应用程序中 .
graph LR
subgraph app
A[your app]
end
subgraph rust
B[BlobStore trait<br/>SqliteBlobStore]
N[StorageNode<br/>iroh-blobs fs store + gc + downloader]
SN[SnatchEngine<br/>proactive replication]
EN[ensure protocol<br/>ALPN freqhole/1]
G[AccessGate<br/>transfer acl seam]
end
subgraph browser ts
TB[./blobs idb records +<br/>opfs/cache bytes]
TT[./transfer snatch/serve/prefetch]
TE[./ensure client + responder]
TW[./worker hashing + opfs io]
end
A --> B & N & SN
SN --> N
EN --> B
G -.gates.-> N
A --> TB & TT & TE
TT --> TW
B --- DB[(reliquary.db<br/>own sqlite file)]
结构
rust/ crate: reliquary
src/
blobz.rs BlobStore trait + sqlite impl (blake3 pk, soft delete, derived blobs)
node.rs StorageNode: fs store lifecycle, init_local/attach_endpoint, gc protect
snatch.rs SnatchEngine over BlobRefSource + PeerProbeTransport traits
ensure.rs EnsureBlobHandler + PeerMessage wire types (ALPN "freqhole/1")
gate.rs AccessGate seam for the iroh-blobs verified-transfer ALPN
hash.rs streaming blake3 helpers
media/ image resize/webp (feature: media), pdf/video thumbs (feature: thumbnails)
chunked_import.rs, identity.rs, db.rs
testing.rs fixtures (feature: test-utils)
examples/ runnable walkthroughs (see below)
migrations/ reliquary.db's own migration set
ts/ npm: @freqhole/reliquary
src/{blobs,transfer,ensure,worker,automerge,utils,solid,testing}
docs/ storage-traits.md (the BlobStore contract design)
生锈:开始
use reliquary::{BlobStore, NewBlobMeta};
use reliquary::testing::make_blobz_store;
let (store, _tmp) = make_blobz_store().await;
let record = store.insert(bytes, NewBlobMeta {
filename: Some("example.txt".into()),
mime: Some("text/plain".into()),
..Default::default()
}).await?;
let bytes_back = store.read_bytes(&record.blake3).await?;
特性( 除 thumbnails编号 :test-utils: blobz, (中文(简体) ), node, (中文(简体) ), snatch, (中文(简体) ),
ensure, (中文(简体) ), gate, (中文(简体) ), media, (中文(简体) ), chunked_import, (中文(简体) ), identity。 。 。 .
cargo run --example blob-round-trip --features test-utils # BlobStore contract, no network
cargo run --example blob-acl-gate --features test-utils # AccessGate over transfer events
cargo run --example snatch-engine --features test-utils # replication engine w/ mock transport
cargo run --example two-peer-blob-transfer --features test-utils # real iroh, two endpoints
ts: 开始
无框架核心子路径; solid-js 编号 : @automerge/automerge-repo 可选对等点
仅由 ./solid 编号 : ./automerge。 。 。 .
| 子路径 | 什麽 |
|---|---|
./blobs | idb 记录商店 + opfs/ cache- api 字节, blake3 canonical ()createBlobStore(中文(简体) ) |
./transfer | snatchBlob编号 :snatchBlobToDisk (暂停/恢复,每例战略下降), BlobServer, (中文(简体) ), Prefetcher |
./ensure | 保证- blob 客户端 + 任何双流响应器( )DEFAULT_ENSURE_ALPN = "freqhole/1"(中文(简体) ) |
./worker | blob 工人( hashing, opfs io, 块上传) + 客户端外观 |
./automerge | Iroh NetworkAdapter + acl 更改取取包装器 |
./utils | 图像使用、散列、标记日志 |
./solid | 创建 Transfer 进步 创建 BlobUrl 创建 DocStore (可选) |
./testing | 模拟流/节点、wav + 决定字节固定装置、 idb 带 |
import { createBlobStore } from "@freqhole/reliquary/blobs";
const store = createBlobStore({
dbName: "myapp-blobs",
allowCacheFallback: false,
});
热量消费者:由工人组成的中间溶液需要 resolveId 在两个插件
plugins 财务报告和审定财务报表 worker.plugins (见skein/loam) vite.config.ts- 一个平地
resolve.alias 只在运行时默默失败 .
开发者快速启动
# rust (no DATABASE_URL needed - queries are runtime-checked)
cargo test --workspace --all-features
cargo fmt --all --check && cargo clippy --workspace --all-targets
# ts
cd ts && npm i
npm run typecheck && npm test && npm run build
箱子拥有自己的sqlite db(reliquary.db) 运行时间,与任何消耗时间分开
应用的db。 今天的消费者:斯克因(hub daemon + tauri + loam, 完全切口),墓葬/备忘录
(hash;存储接合正在进行),播放列表z(计划转移/blops收养).
见 文件/储存-海峡.md blobStore合同设计 墓葬重建计划位于墓葬/道克/xl-重建地.