Skip to content

CreateFileSessionStoreOptions

This content is not available in your language yet.

createFileSessionStore 的选项:存储根目录 + 可选封段阈值、冷层分层存储与可观测回调

optional cold?:
| SegmentBlobStore
| SessionHistoryStore;

冷层(server 份 CreateServeAgentSessionStoreOptions.cold 同名):一级 SegmentBlobStore(S3 / OSS / COS / MinIO / GCS / 文件系统 …:五个字节方法,引擎内置分段 / 编码 / 清单提交 / 热盘 LRU / 重试)或二级 SessionHistoryStore(KV / 关系库自管布局)。缺席 = 仅热层 = 今日行为字节等价 (此时 index / policy / metrics 无效)。


dir: string;

存储根目录(显式传入,恒不隐式扫用户目录;Electron 场景传 userData)


optional index?: SessionIndexStore;

多副本共享会话元 / 无条件写冷层的 CAS 落点。一级冷层 capabilities.conditionalPut:falselist:'none'必填,否则构造期 fail-fast 抛出。


optional metrics?: MetricsRegistry;

tansr_kernel_store_* 指标族注册表;缺省 kernel defaultMetrics


optional onStoreError?: (sessionId, error) => void;

冷层放弃的上传 / 清单提交通报(重试预算耗尽的 transient、permanent、 precondition_failed)。热层已 ack,恒不抛给调用方——该段留在热盘、下次 bind 对账补传。回调抛错被吞。

string

StoreError

void


optional onStoreEvent?: (event) => void;

冷层事件原样回调(store.segment_sealed / store.segment_committed / store.commit_failed / store.hot_full …);回调抛错被吞

ColdTierEvent

void


optional onStoreWarning?: (warning) => void;

store 核警告出口——store_prefix_mismatch(增量径前缀失配 → 已整卷轮换)/ store_pending_rewrite(上次 rewritten 提交未成 → 本次整卷轮换)。缺席静默(轮换本身恒执行,警告只为可观测)。

SessionStoreCoreWarning

void


optional policy?: SegmentedStorePolicy;

分层策略(codec / hotRetention / upload / restore / transform / keyMapper / tenant); 缺省见 kernel SEGMENTED_STORE_DEFAULTShotRetention.maxBytes 触顶 → readiness() 红 + store.hot_full 事件。


optional segmentation?: SegmentationOptions;

卷内动态封段阈值(缺省 16 MiB / 5000 记录)。缺席 = 按缺省 阈值启用;{ enabled: false } = 恒单卷(旧布局)。只影响写侧文件布局:读侧 汇合透明,无 manifest 的旧目录零迁移可读。