Skip to content

pemba 0.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 03 Nov 09:54
· 22 commits to main since this release
7d0b3c6

Fewer Postgres round trips on deep hierarchies, and a FastAPI helper. No migration is needed
from 0.2.0: public APIs keep working and storage formats are unchanged. A custom ReadStore
keeps compiling, because the new trait methods are provided.

Changed

  • Postgres reads make fewer round trips. A request opens its snapshot in one message, and a
    check fetches what each level of a hierarchy may read in one statement. Answers, errors,
    limits and traces are unchanged (docs/T10.1-READ-AHEAD.md). A check 30 folders deep goes
    from 99 round trips to 33 and from 13.3 ms to 6.7 ms (p50), and lookup_resources over
    10,000 documents from 506 to 8 and from 72 ms to 16 ms (benches/RESULTS.md).
  • Inside a read snapshot, Postgres statements use generic plans, set with SET LOCAL, so they
    are not replanned on every call. The first open-ended read below head returns to the
    server's default, for one more round trip.
  • Not every Postgres scenario got much faster. Over three benchmark runs against the baseline,
    shallow checks stayed about level (median p50: direct_hit -2.2%, direct_hit_below_head
    +1.3%, wide_groups_10k_below_head -3.2%) and writes did not change. No scenario was slower in
    all three runs, at p50 or p99, but a single run can be: wide_groups_10k_below_head ranged from
    +30.5% to -20.6% at p50, and write_batch_1000, whose code did not change, from +9.6% to -9.0%
    (benches/RESULTS.md).

Added

  • pemba.contrib.fastapi.Authz, a permission check for FastAPI routes, with the new extra
    pip install pemba[fastapi]. A deny gets a configurable 4xx (403 by default). A transient
    store failure gets a 503 with a fixed detail, and any other engine error a 500. An id the
    engine refuses gets a 422, an at_least bound ahead of the store a 409, and a request with
    no subject a 401, whose headers you can set with unauthenticated_headers. See
    docs/guides/fastapi.md.
  • ReadStore::batch_read_limit and ReadStore::read_batch, provided methods a store may
    implement to batch reads, with BatchRead and BatchAnswer.