ciallo-data

    Shared async data-suite foundation (DataError, cooperative Pool, SingleFlight, SQLCommenter telemetry) for unmbt/ciallo

    data
    pool
    telemetry
    singleflight
    ciallo
    Download zip
    Author
    Version
    0.1.1
    License
    MIT
    Last updated
    13 hours ago
    Downloads
    11

    #unmbt/ciallo-data

    Shared async data-suite foundation for unmbt/ciallo with zero third-party dependencies.

    #Subpackages

    • unmbt/ciallo-data/codec (4 targets): unified DataError suberror with stable error codes and summaries.
    • unmbt/ciallo-data/telemetry (3 targets): QuerySpan, TelemetryConfig, Google SQLCommenter injector (inject_sql_commenter), and lock-free cooperative SingleFlight[V].
    • unmbt/ciallo-data/pool (3 targets): cancel-safe cooperative Pool[Conn] and Lease[Conn] with mark_tainted() eviction.

    DataError

    统一数据套件错误类型(覆盖连接池、超时、协议、鉴权、解码、约束冲突与乐观锁冲突)

    Lease

    连接池租约(协程取消或事务 ROLLBACK 失败时调用 mark_tainted 立即驱逐销毁脏连接)

    Pool

    协作式无锁连接池(同步 while + @async.Cond::wait 防边缘信号丢失;defer + protect_from_cancel 保底归还/销毁)

    PoolConfig

    异步连接池配置(对齐 ADR-012:连接数与获取超时毫秒使用 Int32,空转与生命周期毫秒使用 Int64)

    PoolStats

    QueryObserver

    QuerySpan

    统一数据查询观测 Span(SQL / Redis / MongoDB 共用)

    SingleFlight

    无锁协作式请求合并器(防缓存击穿与并发回源放大;异常/取消均安全唤醒所有等待协程)

    TelemetryConfig

    数据观测配置(支持慢查询阈值、SQLCommenter 注入与回调观察器)

    inject_sql_commenter

    fn inject_sql_commenter(sql : String, traceparent? : String, source_loc? : String, route? : String) -> String

    在 SQL 语句末尾追加 Google SQLCommenter 注释,贯通 W3C traceparent 与源码位置

    Source Files